2
我在下面的代码问题,任何人都可以解决它? 这里是我的代码说明:Facebook的JSON服务不是检索超过1000个Facebook好友
$friends=get_data(https://graph.facebook.com/".$facbookid."/friends?access_token=".Useraccess_token);
这里是GET_DATA功能并返回相应的数据:
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
然后我用JSON服务:
$json = new Services_JSON();
$friends = $json->decode($friends);
echo "print data".$friends->data;
if (isset($friends->data))
{
foreach($friends->data as $friend)
{
$i++;
$friendList[] = $friend->id;
}
}
问题是,当我只有1000个朋友,它检索数据。但当朋友超过1000时它不工作。
Infact,我用过$friends = $json->decode($friends,true);
等 任何人都可以帮我吗?
你使用什么PHP版本?自v5.2以来,通过'json_decode()'进行的本机JSON解码已包含在php中。 http://us3.php.net/manual/en/function.json-decode.php – cpilko 2012-08-01 18:21:03