简体   繁体   English

发布到facebook墙-PHP

[英]post to facebook wall - PHP

i have created an application where user can post message to their own wall ! 我创建了一个应用程序,用户可以在其中将消息发布到自己的墙上! this is my code 这是我的代码

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 />';
}

it returns an error Fatal error: Call to undefined method stdClass::stream_publish() in /home/webshine/public_html/tutorials/fb/example.php on line 149 what is wrong ? 它返回错误致命错误:在第149行的/home/webshine/public_html/tutorials/fb/example.php中调用未定义的方法stdClass :: stream_publish()。

to post on wall you must use api method of facebook object. 要在墙上张贴,您必须使用facebook对象的api方法。

like this. 像这样。

$facebook->api('/me/feed','post',$params);

You're using an old SDK methods apparently. 您显然正在使用旧的SDK方法。

here is some more code 这是更多代码

How do you post to the wall on a facebook page (not profile) 您如何在Facebook页面(而非个人资料)上发布到墙上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM