如何使用带有访问令牌和curl的phpapi向facebook用户墙发帖


How to post to a facebook users wall using the php api with the access token and curl?

以下是我目前正在尝试的内容:

 if (function_exists('curl_init')) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/me/feed');
    curl_setopt($ch, CURLOPT_POST, 2);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "access_token=$facebook_access_token&message=testing api.");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);
} 

其中$facebook_access_token是一个包含访问令牌的变量。

我做错什么了吗?我必须使用phpapi,并且我不明确知道用户的facebook页面url,只有访问令牌。

谢谢。

向cURL:再添加一个选项

CURLOPT_SSL_VERIFYPEER:错误

if (function_exists('curl_init')) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/me/feed');
    curl_setopt($ch, CURLOPT_POST, 2);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "access_token=$facebook_access_token&message=testing api.");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $result = curl_exec($ch);
    curl_close($ch);
}