GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
geonames with Perl  XML
Forum Index -> FAQ - frequently asked questions
Author Message
Anonymous



Hi could anybody help me with using geonames webservice in perl. im really new to this area and really could not find much help in implementing a client for REST on PERL. any help is appreciated.

Thanks in advance,
Hari
marc



Joined: 08/12/2005 07:39:47
Messages: 4412
Offline

Hi Hari

An Article on the O'Reilly Network about consuming a Yahoo REST web service should help to get you started. The article desribes how to make a request and how to parse the xml :

http://www.oreillynet.com/pub/a/network/2005/02/28/yahoo.html

The important part looks like this :

# Make the request
my $yahoo_response = get($req_url);

# Parse the XML
my $xmlsimple = XML::Simple->new();
my $yahoo_xml = $xmlsimple->XMLin($yahoo_response);


The article does not cover url encoding. If you use one of the geonames services whith a placename as parameter you have to url encode the placename before constructing the final url:

use URI::Escape;
$escapedParameter = uri_escape("new york");


Hope this helps.

Marc
[WWW]
 
Forum Index -> FAQ - frequently asked questions
Go to:   
Powered by JForum 2.1.5 © JForum Team