<?php
$name = urlencode( 'Mainz, Germany' );
$baseUrl = 'http://where.yahooapis.com/geocode?flags=GJT&appid=[yourappidhere]&q=';
$data = file_get_contents( "{$baseUrl}{$name}" );
foreach ( json_decode( $data )->ResultSet->Results as $elem )
{
printf( "%s, %s @ %.3f, %.3f\n",
$elem->level3, $elem->level0,
$elem->latitude, $elem->longitude
);
print_r( $elem );
}
?>
Output
http://developer.yahoo.com/geo/placefinder/guide/