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