Arnaud
03-18-2010, 04:40 PM
Hi Folks,
I would like to send an HTTP request to another host, and handle the XML data that it returns.
I am using the following website that provides geo-localisation data in XML format.
For example:
http://ws.geonames.org/findNearbyPlaceName?lat=48.8566667&lng=2.3509871&radius=5&maxRows=3
This returns:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<geonames>
<geoname>
<name>Paris 04 Hôtel-de-Ville</name>
<lat>48.8601</lat>
<lng>2.3507</lng>
<geonameId>3013131</geonameId>
<countryCode>FR</countryCode>
<countryName>France</countryName>
<fcl>P</fcl>
<fcode>PPLX</fcode>
<distance>0.3823</distance>
</geoname>
<geoname>
<name>Paris</name>
<lat>48.85341</lat>
<lng>2.3488</lng>
<geonameId>2988507</geonameId>
<countryCode>FR</countryCode>
<countryName>France</countryName>
<fcl>P</fcl>
<fcode>PPLC</fcode>
<distance>0.3959</distance>
</geoname>
<geoname>
<name>Les Halles</name>
<lat>48.8620115326636</lat>
<lng>2.34694361686707</lng>
<geonameId>7117438</geonameId>
<countryCode>FR</countryCode>
<countryName>France</countryName>
<fcl>P</fcl>
<fcode>PPLX</fcode>
<distance>0.6638</distance>
</geoname>
</geonames>
How would I send the request using a PHP script and display or save that XML data on my web host?
Thanks in advance for any help on that!
I would like to send an HTTP request to another host, and handle the XML data that it returns.
I am using the following website that provides geo-localisation data in XML format.
For example:
http://ws.geonames.org/findNearbyPlaceName?lat=48.8566667&lng=2.3509871&radius=5&maxRows=3
This returns:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<geonames>
<geoname>
<name>Paris 04 Hôtel-de-Ville</name>
<lat>48.8601</lat>
<lng>2.3507</lng>
<geonameId>3013131</geonameId>
<countryCode>FR</countryCode>
<countryName>France</countryName>
<fcl>P</fcl>
<fcode>PPLX</fcode>
<distance>0.3823</distance>
</geoname>
<geoname>
<name>Paris</name>
<lat>48.85341</lat>
<lng>2.3488</lng>
<geonameId>2988507</geonameId>
<countryCode>FR</countryCode>
<countryName>France</countryName>
<fcl>P</fcl>
<fcode>PPLC</fcode>
<distance>0.3959</distance>
</geoname>
<geoname>
<name>Les Halles</name>
<lat>48.8620115326636</lat>
<lng>2.34694361686707</lng>
<geonameId>7117438</geonameId>
<countryCode>FR</countryCode>
<countryName>France</countryName>
<fcl>P</fcl>
<fcode>PPLX</fcode>
<distance>0.6638</distance>
</geoname>
</geonames>
How would I send the request using a PHP script and display or save that XML data on my web host?
Thanks in advance for any help on that!