foreach( $videos_edge_array as $key => $video ) { $requests[$key] = $fb->request('GET', '/'.$video['id'].'/video_insights', [ 'metrics' => 'total_video_views', 'period' => 'lifetime' ] ); } try { $batchResponse = $fb->sendBatchRequest($requests, $config['FACEBOOK']['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; } foreach ($batchResponse as $key => $response) { if ($response->isError()) { $error = $response->getThrownException(); echo $key . ' error: ' . $error->getMessage(); } else { $videos[$key]['insights'] = $response->getGraphEdge()->asArray(); } }
I think code is self descriptive, but this returns me just empty response...
$videos[$key]['insights']
Should have total_views metrics in it, but somehow doesnt resolve from my request... I have no Idea what to do, I already spend a lot of time on this.