雖然這是對使用的谷歌而言,你可以刮掉只是項目如下(或可能的地方API會根據您的需要一個更好的解決方案:http://code.google.com/apis/maps/documentation/places/):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
$input=addslashes($_REQUEST["search"]);
if(strlen($input)>0){
$input=str_replace(" ","+",$input);
$url="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=".$input;
$file=file_get_contents($url);
$start=strpos($file,"pp-headline-item pp-headline-address")+44;
$end=strpos($file,"</span>",$start);
$firstResult=substr($file,$start,$end-$start);
echo $firstResult;
}
else{
echo "You must add the 'search' parameter";
}
?>
</body>
</html>