2014-04-26 55 views
-1

嘿傢伙所有answeres我讀了哪裏真的老,我認爲facebook更新了很多! 有人知道這個問題嗎?知道一個很好的教程或有一些提示?張貼鏈接和Facebook上的圖片與FB-API和PHP的粉絲頁

親切的問候, 弗雷迪

編輯:

我有一個網站,是新聞發佈,我想自動分享我的Facebook粉絲頁面上。這篇文章應該包含一個圖片和我的頁面的鏈接。

+0

你能否詳細說明你的問題+你試過的任何東西 –

+0

@SahilMittal我試過這個:http://talkweb.eu/posting-to-facebook-fan-page-wall-as-an-admin-using-facebook- api/ 但它不適用於我,我認爲。我想在我的Facebook頁面上自動發佈而不需要請求權限。 – fr3ddyf

+0

對不起,但你的問題根本不清楚!有很多不同的可能性。請通過解釋你想要做什麼來使你的問題變小。也正是什麼樣的職位。 –

回答

1

我認爲最好的辦法做到這 -

  1. 首先讓你的網頁的頁面訪問令牌,然後擴展它永遠不會過期。 (獲取頁面訪問令牌所需的權限:manage_pages)。請參閱here如何獲取從不到期頁面訪問令牌。

  2. 然後,只需使用此令牌在頁面的牆上張貼頁面本身!我不知道,如果你使用任何SDK(你有沒有在疑問句中提到),但如果你不想使用anyy SDK,你可以簡單地使用捲曲張貼在牆上

    $url = "https://graph.facebook.com/{page-id}/feed"; 
    $attachment = array(
         'access_token' => $page_access_token, // never-expiring token 
         'message' => '{message}', 
         'picture' => '{picture}', 
         'link' => '{link}' 
    ); 
    
    print_r(json_encode($attachment)); 
    $result = GetContentsUsingCurl($url, $attachment); 
    $result = json_decode($result, TRUE); 
    echo "<pre>"; 
    print_r($result); 
    
    function GetContentsUsingCurl($url, $attachment){ 
        $ch = curl_init(); 
        curl_setopt($ch, CURLOPT_URL, $url); 
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
        curl_setopt($ch, CURLOPT_POST, true); 
        curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment); 
        curl_setopt($ch, CURLOPT_HEADER, 0); 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
        $result = curl_exec($ch); 
        curl_close ($ch); 
    
        return $result; 
    } 
    
+0

謝謝。我現在就試試這個。 – fr3ddyf

+0

確定我現在在工作,但我不知道如何獲得{短命令牌} ...即時對不起......:O – fr3ddyf

+0

作爲登錄/認證的結果返回短標記 –

相關問題