Really simple example on how to use Geonames.org web service from PHP.
Here we will retrieve all the countries from an XML and print it as a combo:
$xmlcountries = 'http://ws.geonames.org/countryInfo';
echo '';
Combo choosing children nodes:
$xml = 'http://ws.geonames.org/children?geonameId='.$gid.'&lang='.$lang;
echo 'Xml '.$xml.'
';
echo '';
Combo to select the language:
$a_lang=array("EN", "DE", "FR", "ES", "JA", "ZH", "RU", "HE", "SV", "BG", "PT", "FI", "KO");//array of current languages
echo '';
I used combos, but can be any other thing, in my case I’ll use more checkboxes.
In this demo,you have all from before and once you select it would be appearing child nodes (states,provinces,cities,neighborhoods…. )
See the demo | Dowload the demo