发布到Facebook墙 - PHP

Sou*_*rav 0 php facebook facebook-php-sdk

我创建了一个应用程序,用户可以将消息发布到自己的墙上!这是我的代码

try {
$facebook = new Facebook(FB_APIKEY, FB_SECRET);
$facebook->api_client->session_key = FB_SESSION;
$fetch = array('friends' =>
array('pattern' => '.*',
'query' => 'select uid2 from friend where uid1={$user}'));

$message = 'Hello There ...';
if ($facebook->api_client->stream_publish($message)) //149th line
echo 'message posted successfully';
} catch(Exception $e) {
echo $e . '<br />';
}
Run Code Online (Sandbox Code Playgroud)

它返回一个错误致命错误:在第149行的/home/webshine/public_html/tutorials/fb/example.php中调用未定义的方法stdClass :: stream_publish()有什么问题?

Hea*_*ota 7

要发布在墙上你必须使用apifacebook对象的方法.

像这样.

$facebook->api('/me/feed','post',$params);
Run Code Online (Sandbox Code Playgroud)

您显然正在使用旧的SDK方法.

这里有一些代码

你如何在Facebook页面上发布到墙上(不是个人资料)