如何直接在Facebook上发布用户墙

时间:2011-03-15 06:30:19

标签: php facebook api publishing

我使用此功能在用户墙上发布,但它显示的是空白页面,而且该帖子未显示在我的墙上:

$url = "https://graph.facebook.com/user_id/feed";
$ch = curl_init();
$attachment =  array(   'access_token'  => access_token_here,                        
                    'name'          => "Rave Kenya",
                    'link'          => "www.youtube.com",
                    'description'   => 'Testing a new facebook app',
                    'message' => 'Tested',

                );

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);
$result =curl_exec($ch);

1 个答案:

答案 0 :(得分:2)

为什么重新发明轮子而不使用facebook php library

5 Steps to publish on a facebook wall using php

提供了逐步说明