php - append two methods in flickr -
i have use 2 methods flickr achieve desired result; "the photos.search method" returns photo id while "geo.getlocation method" returns long , lat value of each photo id. able iterate search each photo id within search area. question how iterate each photo id in "geo.getlocation method" latitude , longitude values.
find below php code returns each photo id:
<?php $url = ("http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=ff8c4c178209865b1ac5ee3f2d492de0&lat=51.5424&lon=-0.1734&radius=2&page=1&text=flats"); $xml = simplexml_load_file($url); foreach ($xml->photos->photo $entry) { echo $entry->attributes()->id; echo $entry->attributes()->owner; echo $entry->attributes()->title; } ?>
the rest request format geo.getlocation method is:
http://api.flickr.com/services/rest/?method=flickr.photos.geo.getlocation&api_key=xxxx&photo_id=[value]
yemi
why not each location iterate on photo ids, in
<?php $url = ("http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=ff8c4c178209865b1ac5ee3f2d492de0&lat=51.5424&lon=-0.1734&radius=2&page=1&text=flats"); $xml = simplexml_load_file($url); foreach ($xml->photos->photo $entry) { echo $entry->attributes()->id; echo $entry->attributes()->owner; echo $entry->attributes()->title; $xmlloc = simplexml_load_file("http://api.flickr.com/services/rest/?method=flickr.photos.geo.getlocation&api_key=xxxx&photo_id=" . $entry->attributes()->id); // process xml file } ?>
Comments
Post a Comment