FB Graph API未响应公共服务器

时间:2016-03-25 17:47:28

标签: php json facebook facebook-graph-api server

我正在尝试使用appid访问我的Page喜欢,使用file_get_contents()在php中访问令牌。 链接是:https://graph.facebook.com/<page_name>?access_token=<my_Access_token>|<my_app_id>&fields=likes

我的FB应用程序处于开发模式,但它在localhost上提供输出,我正在通过MAMP运行。

问题

我的网站托管在BYETHOST上,它使用PHP5.4并且allow_url_fopen为ON。

代码

<?php
$json_url ='https://graph.facebook.com/<page_name>?access_token=<access_token>|<appid>&fields=likes';
$json = file_get_contents($json_url);
$json_output = json_decode($json);
//Extract the likes count from the JSON object
if($json_output->likes){
    $likes = $json_output->likes;
    echo $likes;
}else{
    echo 'FB Request Error!';
}
?>

此代码不能在BYETHOST上运行,但是,如果我将链接更改为https://qrng.anu.edu.au/API/jsonI.php?length=1&type=uint8,它会在localhost和BYETHOST上完美地提供输出。

这可能是什么问题?

0 个答案:

没有答案
相关问题