facebook - HWIOBundle FacebookConnect - data pagination -


i'm using symfony2 hwioauthbundle. managed obtain requested data (including page likes), if number exceeds 24 , user has more 24 page likes facebook api sends next attribute url call following:

...     [24]=>         array(4) {           ["category"]=>           string(26) "computers/internet website"           ["name"]=>           string(10) "ioscreator"           ["id"]=>           string(16) "1488441341444225"           ["created_time"]=>           string(24) "2015-01-30t10:28:42+0000"         }       }       ["paging"]=>       array(2) {         ["cursors"]=>         array(2) {           ["before"]=>           string(20) "mteyotu3odq1ndawnzaw"           ["after"]=>           string(24) "mtq4odq0mtm0mtq0ndiynq=="         }         ["next"]=>         string(99) "https://graph.facebook.com/v2.0/10152896110784845/likes?limit=25&after=mtq4odq0mtm0mtq0ndiynq%3d%3d"       }     } 

does know how request next page within bundle?

here how obtain first response:

$userprovider = $this->container->get('bundlename_user.oauth_provider'); $facebookresourceowner = $this->container->get('hwi_oauth.resource_owner.facebook');  $accesstoken = $request->get('accesstoken'); $userresponse = $facebookresourceowner->getuserinformation(array(     'access_token' => $accesstoken )); 

i don't think there way of doing directly using bundle hwiobundle there 2 ways see doing this.

option 1: add facebookresourceowner.php

in here add in function make request, use libraries contained within hwiobundle. like:

public function nextparamrequest($access_token, $nexturl) {   $response = $this->httprequest($this->normalizeurl($nexturl, array('access_token' => $access_token), array(), array())));    return $this->getresponsecontent($response); } 

option 2: write own curl method it

somewhere in code add following:

function curlnexturl($access_token, $nexturl) {   $request_url = $nexturl."&access_token=".$access_token;    $curl = curl_init();   curl_setopt($curl, curlopt_url, $request_url);   curl_setopt($curl, curlopt_returntransfer, 1);       curl_setopt($curl, curlopt_header, 0);    $response = curl_exec($curl);   curl_close($curl);    return json_decode($response, true); } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -