POST video to Facebook Page through Graph API using PHP -
i need post videos on facebook page using api in php i'm getting following error:
no permission publish video
following code:
$fb = new facebook\facebook([ 'app_id' => '184937xxxxxxxxx', 'app_secret' => '63ba95384b898fxxxxxxxx', 'default_graph_version' => 'v2.10', ]); $data = [ 'title' => 'my foo video', 'description' => 'this video full of foo , bar action.', 'source' => $fb->videotoupload('test.mp4'), ]; $pageaccesstoken ='xxxxxxxxxxxxxxxxxxxxxx'; try { //825870214256735 page id $response = $fb->post('/825870214256735/videos', $data, $pageaccesstoken); } catch(facebook\exceptions\facebookresponseexception $e) { // when graph returns error echo 'graph returned error: ' . $e->getmessage(); } catch(facebook\exceptions\facebooksdkexception $e) { // when validation fails or other local issues echo 'facebook sdk returned error: ' . $e->getmessage(); }
Comments
Post a Comment