This is a test for the new Yahoo Placemaker service - a location extractor for text and web sites.

Simply enter a URL in the following form and submit it. Placemaker then gives you the locations. Results can vary, so re-load the page if needed.

The demo code (PHP):


  if(isset($_POST['url']) && isset($_POST['makeitso'])){
    echo '<h2>Results</h2>';
    $url = filter_input(INPUT_POST, 'url', FILTER_SANITIZE_ENCODED);
    $key = 'ADD-YOUR-KEY-HERE';
    define('POSTURL', 'http://wherein.yahooapis.com/v1/document');
    define('POSTVARS', 'appid='.$key.'&documentURL='.$_POST['url'].
                    '&documentType=text/html&outputType=xml');
    $ch = curl_init(POSTURL);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, POSTVARS);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
    $x = curl_exec($ch);
    $places = simplexml_load_string($x, 'SimpleXMLElement', LIBXML_NOCDATA);    
    if($places->document->placeDetails){
    echo '<table>';
    echo '<caption>Locations for '.urldecode($url).'</caption>';
    echo '<thead>';
    echo '<th scope="row">Name</th>';
    echo '<th scope="row">Type</th>'; 
    echo '<th scope="row">woeid</th>'; 
    echo '<th scope="row">Latitude</th>';
    echo '<th scope="row">Longitude</th>';
    echo '</thead>';
    echo '<tbody>';
    foreach($places->document->placeDetails as $p){
      echo '<tr>';
      echo '<td>'.$p->place->name.'</td>';
      echo '<td>'.$p->place->type.'</td>';
      echo '<td>'.$p->place->woeId.'</td>';
      echo '<td>'.$p->place->centroid->latitude.'</td>';
      echo '<td>'.$p->place->centroid->longitude.'</td>';
      echo '</tr>';
    }
      echo '</tbody></table>';
    } else {
      echo '<h2>Couldn\'t find any locations for '.urldecode($url).'</h2>';
    }
  }