Howto use FB Graph to post a message on a feed (wall)
Posted
by qualbeen
on Stack Overflow
See other posts from Stack Overflow
or by qualbeen
Published on 2010-05-06T18:45:50Z
Indexed on
2010/05/06
18:48 UTC
Read the original article
Hit count: 1023
I have created an app, and now i want to post a message on one of my friends wall with use of the new Graph API. Is this do-able?
I am already using oAuth and the Graph-api to get a list of all my friends. The API at http://developers.facebook.com/docs/api tells me to cURL https://graph.facebook.com/[userid]/feed to read the feed, but it also tells me howto post a message:
curl -F 'access_token=[...]' -F 'message=Hello, Arjun. I like this new API.' https://graph.facebook.com/arjun/feed
Ofcourse this doesn't work! And I can't find out why..
Here are my PHP-code:
require_once 'facebook.php'; // PHP-SDK downloaded from http://github.com/facebook/php-sdk
$facebook = new Facebook(array(appId=>123, secret=>'secret'));
$result = $facebook->api(
'/me/feed/',
array('access_token' => $this->access_token, 'message' => 'Playing around with FB Graph..')
);
This code does not throws any error, and I know my access_token are correct (otherwise i could't run $facebook->api('/me?access_token='.$this->access_token); to get my userobject.
Have anyone out there sucsessfully posted a message using Graph-api? Then i need your help! :-)
© Stack Overflow or respective owner