简体   繁体   English

Php Facebook-从外部来源上传图片

[英]Php Facebook - Upload Image from External Source

Good morning fellows, I am having an issue with facebook api: is it possible to upload a photo from an external source? 大家早上好,我在使用Facebook API时遇到问题:可以从外部来源上传照片吗? For instance, point out an URL and the Facebook will get that... My code is right next 例如,指出一个URL,然后Facebook将得到该代码...接下来是我的代码

$args = array( 'message' => 'Photo from application', 'source' => $im_url );
$url = 'https://graph.facebook.com/'.$album_id.'/photos?access_token='.$token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$data = curl_exec($ch);

the $im_url should point out to an external picture, like store on imageshack,etc. $ im_url应该指出外部图片,例如存储在imageshack等上。
The error it gives me is {"error":{"message":"(#324) Requires upload file","type":"OAuthException"}} 它给我的错误是{"error":{"message":"(#324) Requires upload file","type":"OAuthException"}}

Instead of "source", the term is "url". 该术语不是“源”,而是“ URL”。 Problem solved $args = array( 'message' => 'Photo from application', 'url' => $im_url 问题解决了$args = array( 'message' => 'Photo from application', 'url' => $im_url

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM