致命错误:未捕获的CurlException:26:无法打开文件“”

时间:2013-03-04 08:38:46

标签: php facebook-graph-api curl smarty

<?php
ob_start();
include("/home/coversco/public_html/include/config.php");
ini_set('display_errors', 1);
 error_reporting(E_ALL);


 require 'src/facebook.php';

 $facebook = new Facebook(array(
 'appId' => "xxxxxxxxxxxx", //Facebook App ID
 'secret' => "xxxxxxxxxxxx", // Facebook App Secret
 "cookie" => true,
 'fileUpload' => true
 ));

 $user_id = $facebook->getUser();

 if($user_id == 0 || $user_id == "")
 {
 $login_url = $facebook->getLoginUrl(array(
 'redirect_uri' => 'http://18covers.com/upload/index.php?cover='.$_GET['cover'].'', // Replace with your site url
 'scope' => "publish_stream,user_photos"));

 echo "<script type='text/javascript'>top.location.href = '$login_url';</script>";
 exit();
 }

 //get user album
 $albums = $facebook->api("/me/albums");
 $album_id = ""; 
 foreach($albums["data"] as $item){
 if($item["type"] == "cover_photo"){
 $album_id = $item["id"];
 break;
 }
 }

 //set timeline cover atributes 
 $full_image_path = realpath('{$purl}/t/l-{$p.pic}');
 $args = array('message' => 'Get awesome covers at www.18covers.com');
 $args['image'] = '@' . $full_image_path;

 //upload cover photo to Facebook
 $data = $facebook->api("/me/photos", 'post', $args);
 $picture = $facebook->api('/'.$data['id']);

 $fb_image_link = 'http://www.facebook.com/profile.php?preview_cover='.$data['id'].''; //redirect to uploaded facebook 

cover and change it
 echo "<script type='text/javascript'>top.location.href = '$fb_image_link';</script>";
?>

我已经制作了封面照片的网站,现在我正在尝试添加该功能,让用户只需点击一下按钮即可上传特定的照片。但我遇到了一个问题,问题是我已经指定了变量$full_image_path的图像路径,其中{$purl}/t/l-{$p.pic}是图像的扩展路径。我是否需要输入目录中的路径或URL路径。我输入的是URL路径,它抛出的错误就是这个问题的标题。

如果有人向我展示正确的方向,我将不胜感激。

谢谢。

0 个答案:

没有答案