[英]Facebook API: Uploading photo to the wall?
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 以下是我希望照片显示的方式: http : //screencast.com/t/wnRFBh1xlf
However, here's how it actually shows up: http://screencast.com/t/4WblA7s8fyE 但是,这是它实际出现的方式: http : //screencast.com/t/4WblA7s8fyE
Here's the code I'm using with cURL to upload the photo (or rather, link to it) 这是我用cURL上传照片的代码(或者更确切地说,链接到它)
$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}}" “{”error“:{”message“:”(#100)源网址格式不正确“,”输入“:”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
连接)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.