【发布时间】:2012-01-26 11:59:45
【问题描述】:
早安各位,
我在使用 facebook api 时遇到问题:
是否可以从外部来源上传照片?例如,指出一个 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);
$im_url 应该指向外部图片,例如存储在 imageshack 上等。
它给我的错误是 {"error":{"message":"(#324) Requires upload file","type":"OAuthException"}}
【问题讨论】: