how to use web api with javascript/php?
- by fayer
geonames.org got a web api you can use to get all the hierarchy for a city.
you just enter the id and you will get the data back in xml.
http://ws.geonames.org/hierarchy?geonameId=2657896
i wonder how you fetch the url with php and javascript, and which one should i use.
cause the id's are in the mysql database. i will get them with php.
should i use file_get_contents, curl or fopen?
and what function in javascript? jquery $.post? heard that it can only access localhost.
would be great with some guidance here and even better with some code examples.
thanks!