不确定这是否是您想要的,但如果您实际上将图像发布到 FB,则 FB 正在托管它。
您可以在此处查看不同的帖子类型:
https://developers.facebook.com/docs/reference/api/page/#post_types
我们选择“照片”是因为“链接”显示的图片不是很大。
$api_call = '' . $network['network_id'] . '/photos'; //network_id is the page id
$attachment = array(
'access_token' => $network['network_token'], //access token
'source' => "@" . $image['image_path'], //must be actual path to image
'message' => $campaign['textresponse'],
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'https://graph.facebook.com/' . $api_call);
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);
echo "<br>";
return $result; //returns the post number as json string