1

我正在使用 jQuery 处理我的 Facebook 墙上的 json 数据。对我的 json 文件的调用是这样的:

var url = 'http://graph.facebook.com/myname/feed'; $.getJSON(url+'&callback=?',function(json){...});

自6月4日起。我收到了我需要用户 access_token 的 Facebook 消息。但是我在哪里/如何获得这个令牌?如果我想在我的一生中使用这个令牌,我该怎么办?

4

1 回答 1

0

我遇到了同样的问题,并使用这样的“门”php进行了绕行:

// Settings
$FBid = 'YOUR PAGE ID'; //Page name or Page ID
$app_id = 'YOUR APP ID';
$app_secret = 'YOUR APP SECRET';

$url_get_access_token = 'https://graph.facebook.com/oauth/access_token';
$url_params = "?type=client_cred&client_id=".$app_id."&client_secret=".$app_secret;
$access_token = file_get_contents($url_get_access_token . $url_params);

//Get the contents of a Facebook page
$dataType = 'posts'; // it could be replaced by feed, etc.
$url_fb_data = "https://graph.facebook.com/".$FBid."/".$dataType."?".$access_token;
$FBpage =     file_get_contents($url_fb_data);

//Convert data into a php object format
//$FBdata = json_decode($FBpage);

//Print data in JSON format
echo $FBpage;

有了这个脚本,你所要做的就是改变对这个的调用而不是https://graph.facebook.com/ ......

我希望这对你有帮助,它对我有用。

于 2011-06-08T14:50:32.737 回答