PHPからリクエストを送信するときに、リクエストはサーバーIPから送信され、Googleでは1つのIPに対する制限付きのリクエストが許可されるため、ユーザーのIPからリクエストを送信する方が良いでしょう。あなたは以下のJavaScript関数を使用してそれを行うことができます。
function display_map(address_str,business_name,phone_number,google_local_pages){
var address = address_str;
// Create a new Geocoder
var geocoder = new google.maps.Geocoder();
// Locate the address using the Geocoder.
geocoder.geocode({ "address": address }, function(results, status) {
// If the Geocoding was successful
if (status == google.maps.GeocoderStatus.OK) {
var latlang = results[0].geometry.location;
// alert(latlang);
// Create a Google Map at the latitude/longitude returned by the Geocoder.
var myOptions = {
zoom: 16,
center: results[0].geometry.location,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), myOptions);
// Add a marker at the address.
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
// var data = "<div id='top'><span>"+business_name+"</span><a href='"+google_local_pages+"'>More Info</a><div id='address'>"+address_str+"</div></div>";
var infowindow = new google.maps.InfoWindow({
content: "<div id='top' style='height:175px;width:200px;'><span id='bname' style='font-size: 1.3em;font-weight:bold;'>"+business_name+':'+"</span><a style='text-decoration: none;' target='_blank' href='"+google_local_pages+"'>More Info</a><hr/><div id='address' style='font-size: 1em;font-weight:normal;align:left'>"+address_str+"</div><hr/><div id='lower'><a style='text-decoration: none;' target='blank' href='http://maps.google.com/maps?saddr=&daddr="+address_str+"'"+">Directions</a> <a style='text-decoration: none;' href='javascript:void(0);' onclick='showform();'>Search Nearby</a><div style='display:none;' id='hiddenForm'><hr><span style='font-size: 1em;font-weight:bold;'>Search Nearby:</span><form action='http://maps.google.com/maps' method='get' target='_blank'><input type='text' name='q' id='q' value='' size='12' /><input type='submit' value='GO'/> <span phv='"%1$s"' style='font-size: 0.7em;font-weight: small;'>e.g.,“pizza“</span><input type='hidden' name='near' value='"+address_str+"'/></form></div></div>"
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
});
} else {
try {
console.error("Geocode was not successful for the following reason: " + status);
} catch(e) {}
}
});
}