Last active
June 16, 2017 14:53
-
-
Save yukirafsanjani/176e6679df9168caadfb5a60896a53cb 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 | |
$fb = new Facebook\Facebook([ | |
'app_id' => '{1268465569939619}', | |
'app_secret' => '{1a079294607621d1f034f39b7847d8ee}', | |
'default_graph_version' => 'v2.3', | |
]); | |
$data = [ | |
'title' => 'My Foo Video', | |
'description' => 'This video is full of foo and bar action.', | |
]; | |
$path = 'https://r1---sn-4pgnuhxqp5-jb3y.googlevideo.com/videoplayback?id=b77df3b2b4e27aac&itag=22&source=webdrive&requiressl=yes&ttl=transient&pl=19&sc=yes&ei=-MNDWbD-A4rv-gOE6bb4DA&driveid=0B-LQdU0Iy_bwVjB2NmxrWXpaRDQ&mime=video/mp4&lmt=1496429283636947&ip=2001:19f0:4400:4835:5400:ff:fe74:1120&ipbits=0&expire=1497627704&sparams=driveid,ei,expire,id,ip,ipbits,itag,lmt,mime,mip,mm,mn,ms,mv,pl,requiressl,sc,source,ttl&signature=68452CC1EC894F1C29166639906EA78D2FB1FD97.560B863BB17BE931AEA2022078C0F2985244C73E&key=cms1&title=INDOXXI.NET-[The-Best%20Hit-HD.720p-E01]&cms_redirect=yes&mip=139.0.148.156&mm=31&mn=sn-4pgnuhxqp5-jb3y&ms=au&mt=1497624370&mv=m'; | |
try { | |
$response = $fb->uploadVideo('me', $path, $data, 'access-token'); | |
} catch(Facebook\Exceptions\FacebookResponseException $e) { | |
// When Graph returns an error | |
echo 'Graph returned an error: ' . $e->getMessage(); | |
exit; | |
} catch(Facebook\Exceptions\FacebookSDKException $e) { | |
// When validation fails or other local issues | |
echo 'Facebook SDK returned an error: ' . $e->getMessage(); | |
exit; | |
} | |
$graphNode = $response->getGraphNode(); | |
var_dump($graphNode); | |
echo 'Video ID: ' . $graphNode['id']; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment