我已经创建了一个应用程序,现在我想使用新的 Graph API 在我的一个朋友墙上发布一条消息。这是可行的吗?
我已经在使用 oAuth 和 Graph-api 来获取我所有朋友的列表。http://developers.facebook.com/docs/api上的 API告诉我 cURL https://graph.facebook.com/[userid]/feed来阅读提要,但它也告诉我如何发布消息:
curl -F 'access_token=[...]' -F 'message=Hello, Arjun. I like this new API.' https://graph.facebook.com/arjun/feed
这当然行不通!而且我不知道为什么..
这是我的PHP代码:
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..')
);
此代码不会引发任何错误,并且我知道我的 access_token 是正确的(否则我无法运行 $facebook->api('/me?access_token='.$this->access_token); 来获取我的用户对象。
有没有人成功地使用 Graph-api 发布了一条消息?那我需要你的帮助!:-)