2014-09-02 43 views
0

我试图在我的网站的一个页面上显示我的faciss个人资料的所有文章。我可以得到这个吗?是否有可能从网站上的脸书获得帖子。我可以通过我的脸书个人资料自动在网站上发布脸书帖子吗?

如果可能的话请告诉我解决方案。

取而代之,我已阅读问题here

我用这$token = 'https://graph.facebook.com/oauth/access_token?client_id='.APP_ID.'&client_secret='.APP_SECRET.'&grant_type=client_credentials';

得到的accessToken但正显示出{ "error": { "message": "Error validating application. Invalid application ID.", "type": "OAuthException", "code": 101 } }

我使用权APP_ID和APP_SECRET错误消息..但没能得到的accessToken ..

任何人都可以告诉我如何获得解释的上述问题所需的访问令牌。

回答

0

您需要长期存取令牌。

有一种方法可以将其延长至60天。这里描述: https://developers.facebook.com/docs/roadmap/completed-changes/offline-access-removal/

为了延长访问令牌,你需要提出以下要求与你短暂的访问令牌:

https://graph.facebook.com/oauth/access_token?    
    client_id=APP_ID& 
    client_secret=APP_SECRET& 
    grant_type=fb_exchange_token& 
    fb_exchange_token=EXISTING_ACCESS_TOKEN 

以及如何张贴在墙上使用这个脚本

$page_access_token = 'your access token'; 
$page_id = 'page id'; 
$data['message'] = ""; 
$data['access_token'] = <Your access token>; 
$post_url = 'https://graph.facebook.com/'.$page_id.'/feed'; 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $post_url); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$return = curl_exec($ch); 
curl_close($ch); 
相关问题