I'm trying to upload a photo to my page's wall (and am doing so successfully) but not the way I'd like to.
Here's how I'd like the photo to show up: http://screencast.com/t/wnRFBh1xlf
However, here's how it actually shows up: http://screencast.com/t/4WblA7s8fyE
Here's the code I'm using with cURL to upload the photo (or rather, link to it)
$img_url = "url";
$page_id = "XXXXX";
$url = "https://graph.facebook.com/$page_id/feed";
$fields = array(
'access_token'=>urlencode("XXXXXXX"),
'message'=>urlencode("Far Cry 3!"),
'picture'=>$img_url
);
So, from what I can tell, I should be able to store the image on my server and post the source of the image over, but I just get an error when I do that.
Here's that code and error...
"{"error":{"message":"(#100) source URL is not properly formatted","type":"OAuthException","code":100}}"
$img_url = 'url';
$img = 'temp_image.jpg';
$contents = file_get_contents($img_url);
file_put_contents($img, $contents);
$path = realpath($img);
//echo $path;
//set POST variables
$page_id = "XXXXXX";
$url = "https://graph.facebook.com/$page_id/feed";
$fields = array(
'access_token'=>urlencode("XXXXXXX"),
'message'=>urlencode("Far Cry 3!"),
'source'=>"@".$path
);
I'm not sure what's going wrong here, and have been searching all night for it - with no luck.
Hopefully somebody can give me a clue as to what I should actually be doing.
Thanks!
你在那里发布了/feed
连接,如果你想要更大的图像,你需要将照片实际上传到用户的一个相册(即/photos
连接)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.