Tom Granot-Scalosub Tom Granot-Scalosub - 6 months ago 16
PHP Question

Publish Feed To Facebook Jams Up PHP

I'm using the php SDK for the Graph API, and everything is working fine-getting usernames, uploading photos etc.
However, when I'm trying to publish to the current user's feed, it just makes the page get stuck.

This is the code:

$publish_feed = $facebook->api('/'.$userid'/feed', 'post', array(
'message'=> 'message',
'picture'=> 'http://mysubdomain.mywebsite.com/photo.jpg',
'link'=> 'http://apps.facebook.com/appname/'
););


I've tried:


  1. Putting the code in different places in the code-no matter where I do, it gets the page stuck, Even if ti is at the end of the code, it gets it stuck, and nothing shows.

  2. changing
    $userid
    to
    /me
    . No success.



Please help.

Answer
  1. Make sure you have the publish_stream permission
  2. use /me or api("/$userid/feed",..etc
  3. Remove the extra column:

Code:

$params =   array(
                'message' => 'message',
                'picture'=> 'http://mysubdomain.mywebsite.com/photo.jpg',
                'link'=> 'http://apps.facebook.com/appname/'
            );
$publish_feed = $facebook->api("/$userid/feed", "post", $params);