与Facebook PHP SDK工作:未捕获CurlException:26:未能创建formpost DAT [英] Working with Facebook PHP SDK: Uncaught CurlException: 26: failed creating formpost dat
问题描述
我看了一下有关此错误消息的几个计算器的职位,但他们都不为我工作。
我要上传照片至Facebook:
公共职能uploadPhoto($ PATH){
$ photoSettings =阵列(
ACCESS_TOKEN'=> $这个 - > facebook-> getAccessToken()
'名'=> 上传照片,
'源'=> @。真实路径($ PATH)
); $照片= $这个 - > facebook-> API(ME /照片,POST,$ photoSettings);
}
当我调用这个函数,我得到了以下错误消息:
未捕获CurlException:26:无法创建formpost数据
我100%肯定,我要上传的图片是否存在(和路径是正确的)。
这是我的Facebook初始化:(文件上传为true)
$这个 - > Facebook的=新的Facebook(阵列(
APPID=> $这个 - >配置['APPID'],
'秘密'=> $这 - >配置['appSecret'],
'文件上传'=>真正,
'饼干'=>真正
));
我真的不明白,为什么我得到这个错误,因为我的code似乎是正确的。你认为有可能是一个问题,我的服务器/服务器的卷曲的配置?我不知道很多关于卷曲。
我希望你能帮帮我!我期待着您的回答: - )
问候,
安德烈亚斯
我一直得到CurlException:26:无法创建formpost数据这是我的工作code上传来自同一个目录中与Facebook通信的PHP页面中的照片:
$ Facebook的=新的Facebook(阵列(
APPID=>*****,
'秘密'=>'*******,
'文件上传'=>真正,
'饼干'=>真正
));
$ USER = $ Facebook的 - >的getUser();
如果($用户)
{
$ facebook-> setFileUploadSupport(真);
的$ args =阵列(
'消息'= GT; 从应用程序的考验。,
'形象'= GT; @。真实路径('awesome.jpeg')
);
尝试{
$数据= $ facebook-> API('/ ME /照片','后',$参数);
}赶上(FacebookApiException $ E){
回声错误:。 $ê;
} }
I had a look at several stackoverflow posts about this error message, but none of them worked for me.
I want to upload a photo to facebook:
public function uploadPhoto($path){
$photoSettings = array(
'access_token'=> $this->facebook->getAccessToken(),
'name' => 'uploaded foto',
'source' => '@' . realpath($path)
);
$photo = $this->facebook->api('me/photos','POST',$photoSettings);
}
When i call this function, i get the following error message:
Uncaught CurlException: 26: failed creating formpost data
I am 100% sure that the image i want to upload exists (and the path is correct).
This is my facebook initialization: (fileUpload is true)
$this->facebook = new Facebook(array(
'appId' => $this->config['appId'],
'secret' => $this->config['appSecret'],
'fileUpload' => true,
'cookie' => true
));
I really don't understand why i get that error because my code seems to be correct. Do you think there could be a problem with my server / the server's cURL configuration? I dont know much about cURL.
I hope you can help me! I am looking forward for your answers :-)
Greetings, Andreas
I kept getting "CurlException: 26: failed creating formpost data"
Here is my working code for uploading a photo from the same directory as the PHP page communicating with Facebook:
$facebook = new Facebook(array(
'appId' =>'*****',
'secret' =>'*******',
'fileUpload' => true,
'cookie' => true
));
$user = $facebook ->getUser();
if($user)
{
$facebook->setFileUploadSupport(true);
$args = array(
'message' => 'TEst from App.',
'image' => '@' . realpath('awesome.jpeg')
);
try {
$data = $facebook->api('/me/photos', 'post', $args);
} catch(FacebookApiException $e) {
echo "ERROR: " . $e;
}
}
这篇关于与Facebook PHP SDK工作:未捕获CurlException:26:未能创建formpost DAT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!