Using API To Post Links Does Not Include Picture, Title or Meta Desc PHP

允我心安 提交于 2020-01-13 06:11:46

问题


When posting using the API i receive this:

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

notice how the Title, thumbnail and meta description are missing from the thing.

The following is the code i am using.

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

Referencing how does one post a thumbnail picture to a Facebook /links object? it says the item pulls the picture from the page itself

thoughts?


回答1:


You can do it by passing the following items in the array:

'name' => "post title",
'link' => "url to the page",
'message'=> "message",
'description' => "longer description",
'picture'=>"url of the picture",
'caption' => "Another bit of text"

This removes any reliance on the FB scraper to go out to the url and scrape and parse the data.




回答2:


You need to add the needed og tags to your page.



来源:https://stackoverflow.com/questions/11005891/using-api-to-post-links-does-not-include-picture-title-or-meta-desc-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!