我是 2 个 Facebook 帐户。我用一个用于测试(有 600 个朋友),另一个用于开发(5 个朋友)。我正在尝试使用代码获取用户朋友的所有 id
function get_photo($access_token){
// Run fql query
$fql_query_url = 'https://graph.facebook.com/'
. '/fql?q=SELECT+pid+,object_id+,owner+FROM+photo+WHERE+owner+=+me()+OR+owner+IN+(SELECT+uid2+FROM+friend+WHERE+uid1+=+me())+LIMIT+50'
. '&access_token=' . $access_token;
// First logically check the result, TRUE: Result is passed to $fql_query_result.
// FALSE: $flq_query_result = 0 or false.
$fql_query_result = file_get_contents($fql_query_url)?file_get_contents($fql_query_url):0;
// Only json_decode the result if it was valid.
$fql_query_obj = (!$fql_query_result == 0) ? json_decode($fql_query_result, true) : "FQL was not a valid query";
//display results of fql query
echo '<pre>';
//print_r("query results:");
print_r($fql_query_obj);
echo '</pre>';
return $fql_query_obj;}
我已获得以下权限 user_about_me,read_stream,user_activities,email,user_location,user_photos,friends_photos,publish_actions,user_birthday,user_likes,read_insights,read_insights,user_status';
问题是代码在开发人员帐户中工作,但在测试帐户中出现以下错误。
file_get_contents(https://graph.facebook.com//fql?q=SELECT+pid+,object_id+,owner+FROM+photo+WHERE+owner+=+me()+OR+owner+IN+(SELECT+uid2+FROM+friend+WHERE+uid1+=+me())+LIMIT+50&access_token=AAAEEKwQN3CMBAEUC6DqfakwkSZCdeLI2zk5Ec2evZBJvZB14Nh9e4ZBs8bOOw36F9T2winWRyzSx3vSCcWOl4A80AgcOjEvft1sbW7MLeEE2cyVPCIAb): failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error in /var/www/JMJ_test/facebook_include1.php on line 190
FQL was not a valid query