无法使用 jquery/ajax facebook graph api 上传照片,因为 formpost 数据错误
我有一个对 php 页面的 jquery-ajax 调用,该页面应该将用户照片上传到用户默认相册;但是当调用时发生错误,如下所示
创建模板数据失败 卷曲 异常
这里是上传用户照片的 jquery ajax 函数和 php 脚本的代码:
jquery-ajax 函数:
$.ajax({
type: "GET",
url: "./page1.php",//link to php page
data: "link=" + lnk, //image path
success: function(msg){
alert('upd: '+msg);
},
error: function(msg){
alert('flt: '+msg);
}
});
php 脚本 (page1.php )
$lnk = $_REQUEST['link'];
$facebook->setFileUploadSupport(true);
$attachement = array(‘access_token’ => $session['access_token'],
‘source’ =>’@’ . realpath($lnk),
‘name’ => ‘my ------ friend’,
‘message’ => ‘m pic;get yours at http://apps.facebook.com//‘
);
$fb_photo = $facebook->api(‘me/photos’,'POST’,$attachement);
响应错误转储 ::::: :::::::::::::::::::::::::::::::::::::::::::::::::
> curlException occuring:
> [message:protected] => failed creating
> formpost data [string:private] =>
> [code:protected] => 26
> [line:protected] => 639
> [trace:private] => Array ( [0] =>
> Array (
>
> [file] =>
> /home/*******/public_html/******/facebook.php [line] => 592 [function] =>
> makeRequest [class] => Facebook [type]
> => -> [args] => Array ( [0] => https://graph.facebook.com/me/photos
> [1] => Array (.....
请对此提供帮助; 会很棒的;
陷入这个问题;
i have a jquery-ajax call to php page that is supposed to upload user photos to users default album;but when call is made error occurs as
failed creating formpost data
curl exception
here is the code of jquery ajax function and php script that uploads user photo:
jquery-ajax function:
$.ajax({
type: "GET",
url: "./page1.php",//link to php page
data: "link=" + lnk, //image path
success: function(msg){
alert('upd: '+msg);
},
error: function(msg){
alert('flt: '+msg);
}
});
php script (page1.php )
$lnk = $_REQUEST['link'];
$facebook->setFileUploadSupport(true);
$attachement = array(‘access_token’ => $session['access_token'],
‘source’ =>’@’ . realpath($lnk),
‘name’ => ‘my ------ friend’,
‘message’ => ‘m pic;get yours at http://apps.facebook.com//‘
);
$fb_photo = $facebook->api(‘me/photos’,'POST’,$attachement);
dump of response error :::::::::::::::::::::::::::::::::::::::::::::::::::
> curlException occuring:
> [message:protected] => failed creating
> formpost data [string:private] =>
> [code:protected] => 26
> [line:protected] => 639
> [trace:private] => Array ( [0] =>
> Array (
>
> [file] =>
> /home/*******/public_html/******/facebook.php [line] => 592 [function] =>
> makeRequest [class] => Facebook [type]
> => -> [args] => Array ( [0] => https://graph.facebook.com/me/photos
> [1] => Array (.....
please help regarding this;
it will be great;
stuck in this issue;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论