获取致命错误未捕获CurlException:26:无法打开文件 [英] Getting Fatal Error Uncaught CurlException: 26: couldn't open file

查看:1306
本文介绍了获取致命错误未捕获CurlException:26:无法打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PHP的GD库创建我的朋友的动态图像,我需要将其上传到我的朋友个人资料但我一直收到错误
致命错误:未捕获的CurlException:26:不能打开文件在第820行的/home/p170r760/public_html/myfbapps/mysupporters/base_facebook.php中抛出

  $ image = imagecreatetruecolor(500,500); 
$ orange = imagecolorallocate($ image,0xFF,0x8c,0x00);
$ bg = imagecreatefromjpeg('app2_bg.jpg');
imagesettile($ image,$ bg);
imagefilledrectangle($ image,0,0,499,499,IMG_COLOR_TILED);
$ font_file ='TURNBB __。TTF';
imagefttext($ image,20,0,105,50,$ orange,$ font_file,'我的顶级支持者');
for($ i = 0; $ i< 5; $ i ++){
imagefttext($ image,13,0,10,(100 +($ i * 80)),$ orange,$ font_file,'Rank#'。($ i + 1)。':');
imagefttext($ image,13,0,250,(100 +($ i * 80)),$ orange,$ font_file,$ mutual_friends [$ i] ['name']);
$ frnd_pic = $ facebook-> api('/'。$ mutual_friends [$ i] ['id']。'?fields = picture& type = square');
$ frnd = imagecreatefromstring(file_get_contents($ frnd_pic ['picture']));
imagecopymerge($ image,$ frnd,150,(80 +($ i * 80)),0,0,50,50,100);
$ tags [] =数组(
'tag_uid'=> $ mutual_friends [$ i] ['id'],/ *当前用户的ID * /
'x'=> (150/5),
'y'=>((80 +($ i * 80))/ 5)
);
}
imagepng($ image,'/ img /'。$ me ['id']。'。png');
$ pic = realpath(/ home / p170r760 / public_html / myfbapps / mysupporters /。$ me ['id']。'。png');
$ facebook-> setFileUploadSupport(http://。$ _SERVER ['SERVER_NAME']);
$ pic_id = $ facebook-> api('/ me / photos','POST',数组('message'=>'我的热门支持者',
'来源'=>' @'。$ pic,
'tags'=> $ tags));
imagedestroy($ image);
?>

任何人都可以告诉我哪里出错了?

  $ facebook-> setFileUploadSupport(http://。$ _SERVER ['SERVER_NAME']); 

更改

  $ facebook-> setFileUploadSupport(true)


I am trying to create a dynamic image of my friends using PHP's GD Library, and I need to upload this to my Friends Profile but I keep getting an Error Fatal error: Uncaught CurlException: 26: couldn't open file "" thrown in /home/p170r760/public_html/myfbapps/mysupporters/base_facebook.php on line 820

$image = imagecreatetruecolor(500, 500);
$orange = imagecolorallocate($image, 0xFF, 0x8c, 0x00);
$bg = imagecreatefromjpeg('app2_bg.jpg');
imagesettile($image, $bg);
imagefilledrectangle($image, 0, 0, 499, 499, IMG_COLOR_TILED);
$font_file = 'TURNBB__.TTF';
imagefttext($image, 20, 0, 105, 50, $orange, $font_file, 'My Top Supporters');
for($i=0;$i<5;$i++) {
imagefttext($image, 13, 0, 10, (100+($i*80)), $orange, $font_file,'Rank #'.($i+1).':');
imagefttext($image, 13, 0, 250, (100+($i*80)), $orange, $font_file, $mutual_friends[$i]  ['name']);
$frnd_pic=$facebook->api('/'.$mutual_friends[$i]['id'].'?fields=picture&type=square');
$frnd = imagecreatefromstring(file_get_contents($frnd_pic['picture']));
imagecopymerge($image,$frnd,150,(80+($i*80)),0,0,50,50,100);
$tags[] = array(
       'tag_uid' => $mutual_friends[$i]['id'], /*Current user’s id*/
       'x' => (150/5),
       'y' => ((80+($i*80))/5)
   );  
}
imagepng($image, '/img/' . $me['id'] . '.png');
$pic = realpath("/home/p170r760/public_html/myfbapps/mysupporters/" . $me['id'] .  '.png');
$facebook->setFileUploadSupport("http://" . $_SERVER['SERVER_NAME']);
$pic_id = $facebook->api('/me/photos', 'POST', array('message' => 'My Top Supporters',
'source' => '@' . $pic,
'tags' => $tags));
 imagedestroy($image);
 ?>

Can anyone please tell me where am I going wrong?

解决方案

The setfileUploadSupport API you used is not supported by PHP SDK 3.1 in line

 $facebook->setFileUploadSupport("http://" . $_SERVER['SERVER_NAME']);

Change it

 $facebook->setFileUploadSupport(true)

这篇关于获取致命错误未捕获CurlException:26:无法打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆