【发布时间】:2011-12-26 12:16:01
【问题描述】:
谁能指出一种通过 C 程序在我的 Facebook 墙上发布的方法(不使用任何非标准库;curl 可以!)。
如果没有已知/可用的,您至少可以从 bash shell 中提出一个解决方案(这样我就可以将它与 c system() 一起使用)。我在互联网上找到了一些,但没有一个使用新的 Facebook 图形 API。
【问题讨论】:
标签: c++ c facebook-graph-api curl
谁能指出一种通过 C 程序在我的 Facebook 墙上发布的方法(不使用任何非标准库;curl 可以!)。
如果没有已知/可用的,您至少可以从 bash shell 中提出一个解决方案(这样我就可以将它与 c system() 一起使用)。我在互联网上找到了一些,但没有一个使用新的 Facebook 图形 API。
【问题讨论】:
标签: c++ c facebook-graph-api curl
一旦您向应用程序授予 publish_stream 权限,您就可以执行以下操作从 C
curl = curl_easy_init();
char *data="message=Posting from C&";
strcat(data, "link=http://placekitten.com&");
strcat(data, "picture=http://placekitten.com/90/90&");
strcat(data, "name=Meow&");
strcat(data, "caption={*actor*} places kittens on the wall&");
strcat(data, "description=Some description&");
strcat(data, "access_token=USER_OR_APPLICATION_ACCESS_TOKEN");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
curl_easy_setopt(curl, CURLOPT_URL, "https://graph.facebook.com/me/feed");
/* Disable SSL check (only for testing) */
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_perform(curl); /* post */
Graph API 非常简单,您应该阅读documentation 了解更多信息,在您的情况下,您可能需要阅读有关posting in feed 的更多详细信息
【讨论】: