我正在阅读facebook上的官方文档来创建应用程序。我没有发现任何问题,直到我找到了解释如何发布你的呼喊的部分。
如何使用此代码?我不知道从何说起
curl-F 'access_token =...' \
-F 'message = Hello, Arjun. I like this new API. '\
https: / / graph.facebook.com / Arjun / feed
发布于 2011-05-02 15:46:57
在这里你可以使用facebook sdk。这是一个自述文件,解释了如何连接到facebook:
https://github.com/facebook/php-sdk/blob/master/readme.md
下面是一个更详细的教程
http://thinkdiff.net/facebook/php-sdk-graph-api-base-facebook-connect-tutorial/
发布于 2011-05-03 03:15:29
我找到了解决方案:
<?php
$ogurl = "INSERT_YOUR_OG_URL_HERE";
define(FACEBOOK_APP_ID, "YOUR_APP_ID_HERE");
define(FACEBOOK_SECRET, "YOUR_SECRET_KEY_HERE");
$mymessage = "Hello World!";
$access_token_url = "https://graph.facebook.com/oauth/access_token";
$parameters = "type=client_cred&client_id=" . FACEBOOK_APP_ID .
"&client_secret=" . FACEBOOK_SECRET;
$access_token = file_get_contents($access_token_url . "?" . $parameters);
$apprequest_url = "https://graph.facebook.com/feed";
$parameters = "?" . $access_token . "&message=" .
urlencode($mymessage) . "&id=" . $ogurl . "&method=post";
$myurl = $apprequest_url . $parameters;
$result = file_get_contents($myurl);
// output the post id
echo "post_id" . $result;
}
?>
发布于 2011-05-02 20:54:01
我发布了一个答案给其他人,问了一个非常相似的问题,在这里:facebook extended permissions
如果你使用FB PHP SDK,你不需要担心如何使用cURL (不过,它很简单,而且你可能会在curl man page或php documentation上找到一些好的信息)
https://stackoverflow.com/questions/5854649
复制相似问题