2011-07-27 28 views
1

我正在使用Facebook GRAPH API在用戶的牆上發佈。使用應用程序的名稱在用戶的牆上發佈

它工作正常,但我遇到了一個小問題:

我的出版物出現在用戶與用戶的姓名牆,彷彿他自己出版

我想在他的牆公佈,但與我的應用程序的名稱

我該怎麼做?

回答

0

首先,您需要用戶帖子流權限。當您得到用戶證書,那麼你可以嘗試送$ _ POST,結構類似這樣

$stream_data = array(
        'access_token' => $user_access_token, 
        'caption'  => 'From Your App', 
        'description' => 'Your App description', 
        'link'   => 'http://yourapp.com', 
        'picture'  => 'http://yourapp.com/assets/img/someicon.png', 
        'name'   => $user_sess_name.' just started uses Your App name.', 
       ); 

https://graph.facebook.com/1234/feed(1234是用戶ID)來創建進料流。

0

無法在用戶的牆上張貼並將其歸因於應用程序本身,只有用戶可能在彼此的牆上寫字,應用程序或頁面無法在個人資料牆上書寫。 toopay的答案是從應用發佈到用戶牆上的一個很好的示例,但該帖子將歸因於您使用訪問令牌的用戶

0

我不這麼認爲,您可以在用戶的​​牆上發佈應用名,您可以使用下面的代碼張貼在牆上的用戶,它會在底部說VIA應用程序名稱

$fb = new Facebook(array(
    'appId' => '2420527xxxxxxx', 
    'secret' => 'a6b14d618xxxxxxxxxxxxxxxxxxx' 
)); 

try { 
    $attachment = array(
     'message' => '', 
     'access_token' => $fb->getAccessToken(), 
     'name' => 'Attachment Name', 
     'caption' => 'Attachment Caption', 
     'link' => 'http://www.xxxxxxx.com/app/', 
     'description' => 'Description .....', 
     'picture' => 'http://www.xxxxxxx.com/logo.xxx', 
     'actions' => array(array('name' => 'Action Text','link' =>'http://www.xxx.com/app/')) 
    ); 
$result = $fb->api('/'.$fb->getAppId().'/feed/', 'post', $attachment); 
    echo $result; 
    }catch (FacebookApiException $e) { 
    echo $e->getMessage()."\n"; 
} 

試試吧.. !!!

相關問題