adeel akram
adeel akram

Reputation: 21

create event of facebook using facebook application

how to create an event of facebook using facebook application? further i want to use graph api for that purpose,kindly help me out...

$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);

i have already done the creation of event but picture of event is not shown (i mean a picture represents the face of event)

Upvotes: 0

Views: 1340

Answers (1)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

try doing something like this,

$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'];

Upvotes: 1

Related Questions