This a working example based on the previous posted workflow.
Feedback is as always welcome.
Original project repository: Instagram-PHP-API
The index file contains the Javascript which is responsible for loading new data and a bit of PHP which displays the first results. The script makes use of jQuery's DOM data storage, to store the latest max_id
.
This file represents the API which delivers additional images via pagination
.
It requires two GET
parameters:
tag
the tag name you used in your original request (index.php file)max_id
next max id
and returns a JSON object e.g.:
{
next_id: 1340220451361,
images: [
"http://distilleryimage7.s3.amazonaws.com/d53ffb38bafa11e181bd12313817987b_5.jpg",
"http://distilleryimage8.s3.amazonaws.com/647011aebaff11e188131231381b5c25_5.jpg",
"http://distilleryimage2.s3.amazonaws.com/7206772cbaff11e1b9f1123138140926_5.jpg",
...
]
}
Example AJAX call:
http://example.com/ajax.php?tag=kitty&max_id=1340220451361
Copyright (c) 2011-2012 - Programmed by Christian Metz
Released under the BSD License.
Warning: Invalid argument supplied for foreach() in /home/fotog458/public_html/ajax2.php on line 30
{"next_id":null,"images":[]}