PHPSDKforFacebook:上传使用GraphAPI创建的事件的图像
谁能解释一下我的问题吗PHPSDKforFacebook:上传使用GraphAPI创建的事件的图像,php,facebook,cakephp,facebook-graph-api,Php,Facebook,Cakephp,Facebook Graph Api,谁能解释一下我的问题吗 <?php $config = array(); $config['appId'] = "foo"; $config['secret'] = "bar"; $config['cookie'] = true; $config['fileUpload'] = true; $facebook = new Facebook($config); $eventParams = array( "privacy_type" => $this->requ
<?php
$config = array();
$config['appId'] = "foo";
$config['secret'] = "bar";
$config['cookie'] = true;
$config['fileUpload'] = true;
$facebook = new Facebook($config);
$eventParams = array(
"privacy_type" => $this->request->data['Event']['privacy'],
"name" => $this->request->data['Event']['event'],
"description" => $this->request->data['Event']['details'],
"start_time" => $this->request->data['Event']['when'],
"country" => "NZ"
);
//around 300x300 pixels
//I have set the permissions to Everyone
$imgpath = "C:\\Yes\\Windows\\Path\\Photo_for_the_event_app.jpg";
$eventParams["@file.jpg"] = "@".$imgpath;
$fbEvent = $facebook->api("me/events", "POST", $eventParams);
var_dump($fbEvent); //I get the event id
是的,我们的想法是Facebook有漏洞。 我对事件图片也有问题。这是我的电脑 顺便说一句,您可以在创建事件->
public function uploadFacebookEventPicture($fullPath, $eventId) {
$mainImage = '@' . $fullPath;
$imgData = array(
'picture' => $mainImage
);
try {
$data = $this->facebook->api('/'.$eventId, 'post', $imgData);
return $data;
} catch (FacebookApiException $e) {
error_log('Failed to attach picture to event. Exception: ' . $e->getMessage());
}
return null;
}
也许它对你有用,对我来说,自从Facebook问题被发现后,它就停止工作了。我在创建活动后尝试上传照片,但仍然没有成功。我还尝试使用
//picture
和source
作为参数的键。不起作用。另一件事:当我在应用程序设置中禁用“事件时区”时,我得到一个“稍后重试”错误。该脚本在2周前工作,key param真的没有任何意义,我尝试了不同的,上传成功。。。FB有点问题。至少我们对这个问题的调查并没有给出解决的结果。我认为问题可能是“事件时区”。我的计划是在应用程序管理设置中禁用“事件时区”,然后在事件参数中添加一个时区。此时,如果禁用“事件时区”设置,则会出现以下错误:您必须输入有效的日期和时间