我有正确的access_token
,但是当我致电file_get_contents
时,我收到以下错误:
[function.file-get-contents]: failed to open stream: HTTP request failed!
HTTP/1.1 400 Bad Request in..
在浏览器中粘贴echo $fql_query_url
会得到正确的结果吗?
这是编码问题吗?我问,因为其他的fql查询工作正常。这是有问题的代码:
<?php
require_once('facebook.php');
//GET access token
echo $uid = $facebook->getUser();
$access_token = $facebook->getAccessToken();
echo '<br>';
// Run fql query
$fql_query_url = 'https://graph.facebook.com/'
. '/fql?q=SELECT page_id from page_admin WHERE uid='.$uid.''
. '&access_token=' . $access_token;
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);
//display results of fql query
echo '<br><pre>';
print_r("query results:");
print_r($fql_query_obj);
echo '</pre>';