Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

282 Part III — Google Map Hacks


print header(-type => ‘text/xml’);

my @query;

foreach my $param (param())
{
push @query,sprintf(‘%s=%s’,$param,param($param));
}

my $query = ‘http://www.flickr.com/services/rest/?’. join(‘&’,@query);

my $response = $ua->get($query);

print $response->{_content};

Now you can build a URL just as if you were directly building one for the Flickr service and
access the information returned by Flickr without hitting the browser security issue that pre-
vents you from doing this directly.

Searching Flickr for Photos


You can search for Flickr photos using a variety of criteria with the flickr.photos.search
method. You can request photos based on the following search criteria:

User ID
Tags (you can also specify whether to search for photos matching any tags or to search
for all of them)

Text search (based on title, description, or tag)
Upload date

Taken date
License

You can also specify the sort order of the returned list of photos, the number of photos to be
returned in a page (up to 500), and which page of the search requested to return photos. For
example, if you request 100 photos per page from page 3, photos start at number 301 in the
returned results.

Sending a Search Request
You can submit a search for a specific user’s photos (I’ll use my photos as an example) and look
for photos with specific tags. When you send the request with the REST interface, XML for the
photo information is returned. You can see a sample of the returned data in the following code:
<rsp stat=”ok”>
<photos page=”1” pages=”1” perpage=”100” total=”79”>
<photo id=”24910903” owner=”54256647@N00” secret=”ad24b49370” server=”23” ;
title=”IMG_0776” ispublic=”1” isfriend=”0” isfamily=”0”/>
<photo id=”24910888” owner=”54256647@N00” secret=”1b92a07883” server=”23” ;
title=”IMG_0777” ispublic=”1” isfriend=”0” isfamily=”0”/>
Free download pdf