0
http://maps.googleapis.com/maps/api/geocode/xml에 PHP 스크립트를 사용하여 우편 번호를 lon/lat로 지오 코딩합니다. 우리는 OVER_QUERY_LIMIT 상태를 지속적으로 유지하고 있습니다. 우리가 1 일 동안 우편 번호를 저장하더라도.Google지도 API - 클라이언트 측 OVER_QUERY_LIMIT
클라이언트 쪽 지오 코딩을 살펴보고 싶지만 정확하게 설명하지는 않았습니다. 제발 누군가가 이것 좀 봐하고 우리가 overimit을 치지 않도록 이걸 다시 쓰는 것이 가장 좋은 방법을 볼 수 있습니다.
감사
<?php
//database and connection are defined elsewhere
mysql_select_db($database, $connection);
//check if postcode exists in database
$sqlTS1 = mysql_query("SELECT * FROM `postcodestable` WHERE `postcode` = UPPER('" . $_GET['postcode'] . "') AND `date_added` > DATE_SUB(NOW(), INTERVAL 1 DAY)");
if(mysql_num_rows($sqlTS1)>0) {}
else
{
$postcodeTS1 = strtoupper($_GET['postcode']); // post code to look up
$request_url = "http://maps.googleapis.com/maps/api/geocode/xml?address=".$postcodeTS1."&sensor=true";
$xml = simplexml_load_file($request_url) or die("url not loading");
$status = $xml->status;
if ($status=="OK")
{
//request returned completed time to get lat/lang for storage
$latTS1 = $xml->result->geometry->location->lat;
$longTS1 = $xml->result->geometry->location->lng;
}
//insert into postcodes table for server side caching of lon lat
$dateTS1= date('Y-m-d H:i:s');
$sqlinsert="INSERT INTO postcodestable (postcode,latitude,longitude, date_added) VALUES ('".$postcodeTS1."', '".$latTS1."', '".$longTS1."', '".$dateTS1."')";
$sqlinserting = mysql_query($sqlinsert) or die(mysql_error());
}
// we can now use $latTS1 and $longTS1 elsewhere within the HTML page
// we then run another script that removes all postcodes from Table where date_added is greater than 1 day.
?>
클라이언트 측은 일반적으로 자바 스크립트를 사용하여 호출을 처리하는 것을 의미합니다. 따라서 서버 측 코드 – islanddave
보다는 html/js에 요청을 추가해야합니다. 내가 시도하고 지리 코드 자바 스크립트에 대한 검색 후 PHP로 변수를 변환합니다. 나는 php로 괜찮지 만 자바 스크립트가 아니다. –
한계 문제를 극복하기 위해 노력하지 않을 것이다. 모든 PHP는 서버 측에서 실행됩니다. JS는 클라이언트 측에서 실행됩니다 (사용자 브라우저에서는 서버에서 실행되지 않음). GMaps는 그 차이를 안다. – islanddave