在flickr中追加两个方法


append two methods in flickr

我必须使用Flickr中的两种方法才能达到我想要的结果;"photos.search方法"返回照片id,而"geo.getLocation方法"返回每个照片id的long和lat值。我能够成功地迭代我的搜索,以获得我的搜索区域内的每个照片id。我的问题是如何迭代"geo.getLocation方法"中的每个照片id,以获得它们的纬度和经度值。

在下面找到我的php代码,返回每个照片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 as $entry) {  
echo $entry->attributes()->id;
echo $entry->attributes()->owner;
echo $entry->attributes()->title; 
}
?>

geo.getLocation方法的REST请求格式为:

http://api.flickr.com/services/rest/?method=flickr.photos.geo.getLocation&api_key=xxxx&photo_id=[value]

Yemi

为什么不像在中那样,在迭代照片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 as $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
}
?>