다음과 같은 문제가 있습니다. 위도와 경도의 주소와이 위치의지도 스냅 샷을 얻기 위해 PHP에서 Google지도를 사용하고 있습니다. Google지도 주소 및지도 표시 (한도 초과)
내가 다음 코드를 사용하십시오 주소를 얻으려면 :// INITIALIZING CURL
$returnValue = NULL;
$ch = curl_init();
// SERVICE CALL
$url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=".$lat.",".$lon."&sensor=false";
// SETTING PARAMS OF CURL
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
// GETTING AND RESULTING RESULT
$result_part = curl_exec($ch);
$json = json_decode($result_part, TRUE);
다음과 같이 내가 JSON을 얻을 구문 분석 : 그것은 잘하지만 때로는 주소를 얻을 수 없다 작동
// PARSING RESULTS FROM JSON
if (isset($json['results'])) {
foreach ($json['results'] as $result_part) {
foreach ($result_part['address_components'] as $address_component) {
$types = $address_component['types'];
// GETTING STREET
if (in_array('route', $types)) {
$addr = $address_component['long_name'];
}
// GETTING STREET NUMBER
if (in_array('street_number', $types)) {
$number = $address_component['long_name'];
}
// GETTING COUNTRY
if (in_array('country', $types)) {
$country = $address_component['long_name'];
}
// GETTING POSTAL CODE
if (in_array('postal_code', $types)) {
$postal_code = $address_component['long_name'];
}
// GETTING CITY
if (in_array('locality', $types)) {
$city = $address_component['long_name'];
}
}
}
}
. 그것은 요청의 일부 과부하처럼 보입니다. 그러나 왜 프로그래밍중인 사이트가 다른 사람들에게 접근 할 수 없기 때문에 이해가 안됩니다.
다른 문제는지도 스냅 샷입니다. 여기 코드는 다음과 같습니다
는<? echo "<a href = \"https://maps.google.com/maps?q=".$lat.",".$lon."\" target=\"_blank\">" ?>
<? echo "<img src=\"http://maps.googleapis.com/maps/api/staticmap?center=" . $lat . "," . $lon . "&zoom=16&size=200x200&markers=color:blue%7Clabel:I%7C" . $lat . "," . $lon . "&sensor=false\" alt=\"google maps\" width=\"200\" height=\"200\" /></a>" ?>
이 또한 잘 작동하지만, 때로는이 같은 이미지를 얻을 :
내가 한도를 초과 의심.
아이디어가 있으십니까? 답변 해 주셔서 감사합니다.
'나는 한계를 초과했는지 의심 스럽다. 어떤 아이디어입니까? '는 공유 웹 호스트 (RackSpace와 같은)에있는 것입니까? – geocodezip
아니요 공유 된 웹 호스트에 없습니다. 자체 웹 서버에 있지만이 웹은 회사의 웹 페이지에도 사용됩니다. Google이 하나의 IP를 통해 해당 회사의 모든 사람들의 액세스를 제어 할 수 있습니까? IP 주소가 – Reshi
인 사용자 그룹이 너무 많아서 너무 많은 요청 때문에지도 서비스를 차단하지 않습니까? – Reshi