私はこのコードを使ってreddit.comの投稿からデータを取得しています...これは1500の投稿までうまくいきます(10000のデータを取得する必要があります)。それは言って、エラーをredditのデータ収集がPHPループの途中で終了する
array_merge()を得る:引数#1は
このエラーは、私が書いている行からトリガー配列ではありませんarray_merge
コード
<?php
$count = 0;
for($digit=0; $count<2001; $digit+=1){
$jsondata = trim(file_get_contents("http://www.reddit.com/new/.json?count=$count&limit=100"));
$json = json_decode($jsondata, true);
$postdata[$digit] = $json['data']['children'];
$mergedArray = array_merge($mergedArray, $postdata[$digit]);
}
foreach($mergedArray as $livedata){
$output .= $livedata["data"]["ups"].", ";
$output .= '"'.$livedata["data"]["title"].'", ';
$output .= $livedata["data"]["id"].", ";
$output .= $livedata["data"]["num_comments"].", ";
$output .= $livedata["data"]["domain"]."\n\r";
$output .= "<br />";
}
echo $output;
?>
どのような身体でもエラーを見つけて、私が10000の投稿を途切れないようにする方法を教えてください
誰か助けてくださいね?? –