Created
October 7, 2013 17:52
-
-
Save anonymous/6872121 to your computer and use it in GitHub Desktop.
Modified version of 'https://github.com/eosgood/fbphpsdk/blob/master/async/photo.php' to support video uploads. Tested with 177 MB MKV video.
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 | |
// Provides access to app specific values such as your app id and app secret. | |
// Defined in 'AppInfo.php' | |
require_once('../utils/AppInfo.php'); | |
require_once('../facebook-php-sdk/src/facebook.php'); | |
$facebook = new Facebook(array( | |
'appId' => AppInfo::appID(), | |
'secret' => AppInfo::appSecret(), | |
)); | |
$facebook->setFileUploadSupport(true); | |
if (isset($_POST['graph'])) { | |
$user = $facebook->getUser(); | |
$data = array(); | |
$img = '../vid/example.mkv'; | |
$post_data = array( | |
'videoData' => '@' . $img, | |
'title' => 'Test Video Upload', | |
'description' => 'Video uploaded with the php sdk', | |
); | |
try { | |
$data = $facebook->api( | |
'/me/videos', 'POST', | |
$post_data | |
); | |
} catch(FacebookApiException $e) { | |
$data = array('error' => $e->getMessage()); | |
} | |
echo json_encode($data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment