【发布时间】:2015-11-15 21:14:29
【问题描述】:
我希望我的网站能够在网站的粉丝页面上发布消息。
所以我使用我找到的这段代码:
<?php
require_once("assets/facebook.php");
$facebook = new Facebook(array(
'appId' => '471898006354908', // Fake
'secret' => 'd2f7fb2dbc0ab7f42bc1c4337ab041b1', // Fake
'cookie' => true
));
$access_token = $facebook->getAccessToken();
echo $access_token;
$msg = "testmsg";
$title = "testt";
$uri = "http://somesite.com";
$desc = "testd";
$pic = "http://static.adzerk.net/Advertisers/d18eea9d28f3490b8dcbfa9e38f8336e.jpg";
$attachment = array(
'access_token' => $access_token,
'message' => $msg,
'name' => $title,
'link' => $uri,
'description' => $desc,
'picture'=>$pic,
'actions' => json_encode(array('name' => $action_name,'link' => $action_link))
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/me/feed');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //to suppress the curl output
$result = curl_exec($ch);
curl_close ($ch);
?>
每次我执行该页面时,它都会向我回响如下内容:
471898006354908|d2f7fb2dbc0ab7f42bc1c4337ab041b1
但它没有在我的粉丝页面上发布任何内容?
有什么帮助吗?
【问题讨论】: