开发者

PHP SDK: Post to FB application's wall as the app itself

开发者 https://www.devze.com 2023-04-03 04:51 出处:网络
There are a lot of questions on SO about this, but not exactly what I am looking for. In my case, users can log in through Facebook/Twitter/other. And they can upload an image.

There are a lot of questions on SO about this, but not exactly what I am looking for.

In my case, users can log in through Facebook/Twitter/other. And they can upload an image. Once they upload an image, two things will happen. The FB user's status is updated with an attachment to the link. And on the FB App's wall, a status update is also posted but by the application itself and not by the user. I am having trouble with t开发者_如何转开发his last part. So the user does not have to be logged in through Facebook for this latter to occur.

My code:

$facebook = new Facebook($config);

$attachment = array(
'message' => 'A user just posted a new item',
'name' => $tag,
'caption' => $desc,
'link' =>  WEBURL,
'description' => '',
'picture' => $img,
'actions' => array(array('name' => 'Go to item',
                  'link' => WEBURL))
);


$facebook->api('/'.PAGEID.'/feed', 'POST', $attachment);


An application's wall behaves exactly like a page's wall or a user's wall. Lookup the documentation for those.

0

精彩评论

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

关注公众号