【问题标题】:Facebook POST HTTP curl in PHPPHP中的Facebook POST HTTP curl
【发布时间】:2013-02-24 10:19:20
【问题描述】:

自学一些通过 PHP 发布的 Facebook 提要,我试图弄清楚如何通过 PHP curl 命令执行这个 curl HTTP POST,有什么建议吗?

curl -X POST \
     -F 'message=Post%20with%20app%20access%20token' \
     -F 'access_token=YOUR_APP_ACCESS_TOKEN' \
     https://graph.facebook.com/4804827/feed

找到here

【问题讨论】:

标签: php facebook curl http-post


【解决方案1】:

这是怎么做的:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://graph.facebook.com/4804827/feed");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
    'message' => 'Post with app access token',
    'access_token' => 'YOUR_APP_ACCESS_TOKEN'
));

echo curl_exec($ch);
curl_close($ch);

我建议查看文档:

http://www.php.net/manual/en/function.curl-init.php

http://www.php.net/manual/en/function.curl-setopt.php

【讨论】:

  • 出于某种原因,我没有将两个和两个放在一起作为文档,现在这很有意义,谢谢。
猜你喜欢
  • 2011-01-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-13
  • 1970-01-01
相关资源
最近更新 更多