使用API​​发布链接不包括图片,标题或Meta Desc PHP

Zac*_*ter 2 php facebook facebook-wall facebook-graph-api facebook-php-sdk

使用API​​发布时,我会收到:

https://www.facebook.com/weather.warnings/posts/329128793830700

注意事物中缺少标题,缩略图和元描述.

以下是我正在使用的代码.

$allalert = array
(
'oauth_token' => 'not pasting this thanks :P',
'message' => "New $type for $where",
'link' => $url,
);
$sendalert = $facebook->api('/125291287567922/links/','POST',$allalert);
Run Code Online (Sandbox Code Playgroud)

引用一个人如何张贴缩略图到一个网站/链接对象?它说该项目从页面本身拉出图片

想法?

Ste*_*tty 5

您可以通过传递数组中的以下项来完成此操作:

'name' => "post title",
'link' => "url to the page",
'message'=> "message",
'description' => "longer description",
'picture'=>"url of the picture",
'caption' => "Another bit of text"
Run Code Online (Sandbox Code Playgroud)

这消除了对FB scraper的依赖,以便访问URL并刮取和解析数据.