使用facebook应用程序创建facebook的活动

时间:2012-09-28 11:25:50

标签: php facebook

如何使用facebook应用程序创建facebook事件? 我想为此目的使用图形api,请帮助我...

$access_token = 'app_access_token';
$url = "https://graph.facebook.com/app_id/events";
$postdata = "access_token=$access_token&name=$name&start_time=$start_time&end_time=$end_time&description=$description&privacy=$privacy&location=$location&picture=$picture_source";             
$event_code = curl_sending_newsfeed_facebook($url, $postdata);

我已经完成了事件的创建,但事件的图片没有显示(我的意思是图片代表事件的面貌)

1 个答案:

答案 0 :(得分:1)

尝试做这样的事情,

$fb = new Facebook(array(
    'appId' => YOUR_APP_ID,
    'secret' => YOUR_APP_SECRET,
    'cookie' => false,
    'fileUpload' => true
));
$imageFile = realpath('/path/to/your/example.jpg');
$eventInfo = array(
    'name' => 'some title',
    'start_time' => time()+32400,
    'description' => 'some description',
    basename($file) => '@'.$imageFile    
);
$result = $fb->api(
    '/'.$app_id.'/events',
    'post',
    $eventInfo
);
echo 'Created event #'.$result['id'];