php - Set an offset/limit for "/me/photos" call in Facebook Graph API -


This array gives an array sorted in the chronological order, how do I specify the offset / range for the query?

  $ photos = $ facebook- & gt; API ('me / photo');    

This order is based on the parameter created_time To do

http://developers.facebook.com/tools/explorer/?method=GET&p;path=me%2Fphotos%3Ffields%3Dcreated_time%2Cupdated_time

The paging property allows you to cross the set at the end of each JSON response. "Paging": {"previous": "https://graph.facebook.com / me / photos? Fieldss = created_time \ u00252updated_time & value = 1 & redirect = 1 & amp; limit = 25 & amp; = 1341554766 "," next ":" https://graph.facebook.com/me/photos?fields=created_time For example, to get all the photos,

  if \ u00252updated_time & amp; value = 1 & amp; redirect = 1 & amp; limit = 25 & amp; = 1311564489 "}   

($ User_id) {$ The_photos = array (); $ Your_photos = $ facebook- & gt; API ("me / photo"); While ($ your_photos ['data']) {$ the_photos = array_merge ($ the_photos, $ your_photos ['data']); $ Paging = $ your_photos ['paging']; $ Next = $ paging ['next']; $ Query = parse_url ($ Next, PHP_URL_QUERY); Parse_str ($ query, $ equal); $ Your_photos = $ facebook- & gt; API ("Me / Photo", "GET", array ('border' => $ par ['border'], 'unless' = & gt; $ par ['as long'])); } Echo count ($ the_photos); }

If you still do not feel comfortable with it, just switch out and use offset and threshold Permitted Parameters as well as increase the offset parameter with each cross border.

Comments