开发者

post to facebook wall - PHP

开发者 https://www.devze.com 2023-02-22 12:06 出处:网络
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);

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->str开发者_如何学运维eam_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 ?


to post on wall you must use api method of facebook object.

like this.

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

You're using an old SDK methods apparently.

here is some more code

How do you post to the wall on a facebook page (not profile)

0

精彩评论

暂无评论...
验证码 换一张
取 消