-1

通过 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

这里找到

4

1 回答 1

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

于 2013-03-08T19:05:17.540 回答