남자 나는이 코드를 사용하여 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 개의 게시물을 얻을 수있는 방법을 알 수 있습니다.
누구든지 나를 도와주세요 ?? –