2014-09-02 63 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); 
相關問題