尝试使用图形 api 创建事件时出现以下错误
致命错误:未捕获的 OAuthException:(#100) 第 1267 行 C:\xampp\htdocs\fb\base_facebook.php 中抛出的参数无效
任何人都可以帮我解决这个问题。
以下是我的代码: -
<?php
include_once("facebook.php");
define("FACEBOOOK_API_KEY","XXXXXXXXXXXXXXXXXXXXX");
define("FACEBOOK_SECRET_KEY","XXXXXXXXXXXXXXXXXXXXXXXX");
/*$name = $_POST['name'];
$token = $_POST['access_token'];
$startTime = $_POST['start_time'];
$endTime = $_POST['end_time'];
$location = $_POST['location'];
$description = $_POST['description'];*/
$name = "My Amazing Event";
$token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx';
$startTime = '10/29/2011 12:00 PM';
$endTime = '10/29/2011 06:00 PM';
$location = 'Raipur';
$description = 'It will be freaking awesome';
$fileName = "tiger.jpg"; //profile picture of the event
$fb = new Facebook(array(
'appId' => FACEBOOOK_API_KEY,
'secret' => FACEBOOK_SECRET_KEY,
'cookie' => false,
'fileUpload' => true // this is important !
));
$fb->setAccessToken($token);
$data = array("name"=>$name,
"access_token"=>$token,
"start_time"=>$startTime,
"end_time"=>$endTime,
"location"=>$location,
"description"=>$description
//basename($fileName) => '@'.$fileName
);
$post_data[basename($fileName)] = '@' . realpath($fileName);
$result = $fb->api('/me/events', 'POST', $data);
$facebookEventId = $result['id'];
echo $facebookEventId;
?>
提示帮助将不胜感激。谢谢!