php - pagination within the facebook API (photos) -


i'm developing facebook app needs access users photos. needs loop through of users active photos i'm having trouble pagination aspect of feed. results api

stdclass object (     [data] => array         (             [0] => stdclass object                 (                     [id] => 10151796309135076                     [from] => stdclass object                         (                             [name] => daniel benzie                             [id] => 762525075                         )                 )         ) ) 

obviosuly above excerpt , down bottom there section next , previous pages.

[previous] => https://graph.facebook.com/762525075/photos?access_token=xxxxxxx&limit=25&since=1338985293&__previous=1 [next] => https://graph.facebook.com/762525075/photos?access_token=xxxxx&limit=25&until=1332002972 

this set- know best way loop through photos in case? in advance (:

keep calling next url until there no more data

while ($some_photos['data']) {     $all_photos = array_merge( $all_photos, $some_photos['data'] );      $paging = $some_photos['paging'];     $next = $paging['next'];      $query = parse_url($next, php_url_query);     parse_str($query, $par);        $some_photos = $facebook->api(         $user_id."/photos", 'get', array(             'limit' => $par['limit'],             'until'  => $par['until'] )); } 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -