I am trying to post a message to a user’s feed (wall).
I’ve already got the publish_stream permission and have the user’s id ($fbid) and access token ($access_token), however I am only able to post an empty message to the wall.
This is what the post looks like:
User Name
Like · Comment · 12 minutes ago via AppName
So basically all the content of the message is missing (everything in the $data variable).
This is the code I used:
include 'facebook.php';
$facebook = new Facebook(array(appId => $app_id,
secret => $app_secret,
cookie => true));
$data['post'] = array('access_token' => $access_token,
'message' => 'Sign up now',
'picture' => 'http://myurl.com/images/pic.jpg',
'link' => 'http://myurl.com/',
'caption' => 'Get early access to our app');
$post_id = $facebook->api('/'.$fbid.'/feed/', 'post', $data);
What am I missing? Why is $data content not displayed in the post?
The problem is with
$data['post']you are not sending correct data to the API.Change it to
$dataI am not really sure why you have the ‘post’ part in there for.If you need it in the format
$data['post']then change your API call to readSee example at https://gist.github.com/3378724