Created
March 9, 2011 21:35
-
-
Save caefer/863054 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__.'/vendor/facebook/src/facebook.php'; | |
$app_id = '1234567890'; | |
$secret = '0123456789abcdef0123456789abcdef0123456789abcdef'; | |
$fb = new Facebook(array( | |
'appId' => $app_id, | |
'secret' => $secret, | |
'cookie' => false, | |
'fileUpload' => true // this is important ! | |
)); | |
// alternatively you can enable file upload on the instance | |
// $fb->setFileUploadSupport(true); | |
// the image you want to use on your event | |
$file = realpath('/path/to/your/example.jpg'); | |
$eventInfo = array( | |
'name' => 'some title', | |
'start_time' => time()+32400, | |
'description' => 'some description', | |
basename($file) => '@'.$file, | |
// `-> 'example.jpg' => '@/path/to/your/example.jpg' | |
); | |
$result = $fb->api( | |
'/'.$app_id.'/events', | |
'post', | |
$eventInfo | |
); | |
echo 'Created event #'.$result['id']; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment