gpt4 book ai didi

c++ - 从 c/c++ 或 linux 发布到 facebook 墙上

转载 作者:太空狗 更新时间:2023-10-29 21:27:45 24 4
gpt4 key购买 nike

谁能指出一种从 C 程序发布到我的 Facebook 墙上的方法(不使用任何非标准库;curl 没问题!)。

如果没有已知/可用的,您能否至少从 bash shell 中提出一个解决方案(这样我就可以将它与 c system() 一起使用)。我在互联网上找到了一些,但没有一个使用新的 Facebook 图形 API。

最佳答案

一旦您授予应用程序 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 的一些其他详细信息

关于c++ - 从 c/c++ 或 linux 发布到 facebook 墙上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8635674/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com