我的Facebook SDK自动发布到我的Facebook业务页面有问题。
这是工作代码,但现在它显示错误
"(#100) Only owners of the URL have the ability to specify the picture, name, thumbnail or description params. FacebookApiException"
我创建cakePHP脚本以自动将Facebook发布到我的页面。我创建了新的应用程序 - >我拿了App Id和Secret ID。我创建了Access Token很长时间了。当然,我在FB上为我的页面验证了域名。
出了什么问题......?我什么都不知道!
请找到我的代码
$config = array();
$config['appId'] = '16xxxxxxxxxxxx';
$config['secret'] = 'a24faxxxxxxxxxxxxxxxxxxxxx';
$config['fileUpload'] = false; // optional
$link = SITE_URL.'/PostAds/details/'.base64_encode($post_id);
$name = $this->request->data['title'];
$price = $this->request->data['price'];
$city = $this->request->data['city'];
$fb = new \Facebook($config);
$img_link = webroot.'/uploads/postAd/'.$image_name;
$params = array(
"access_token" => 'EAACZA18CF5TcBAL0E4XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
"message" => $name.' - '.$city.' Price:'.$price,
"link" => $link,
"picture" => $img_link,
"name" => $name,
"description" => $name.' '.$price,
"published" => true
);
try {
$ret = $fb->api('/page-id/feed', 'POST', $params);
echo 'Successfully posted to Facebook';
} catch(Exception $e) {
echo $e->getMessage();
}