我想在我的網站上實現谷歌地圖標記。但它只顯示一個藍色屏幕和一個標記。我無法在那裏看到任何地圖。請參閱下面的代碼。我用mykey取代了apikey。谷歌地圖顯示藍屏
<?
define("MAPS_HOST", "maps.google.com");
define("KEY", "mykey"); // Place your API Key here...
// Get our address (from a database query or POST
$address = "india";
// Build our URL from the above...
$base_url = "http://" . MAPS_HOST . "/maps/geo?q=" . $address . "&output=csv" . "&key=" . KEY;
// Initalise CURL
$c = curl_init();
// Get the URL and save the Data
curl_setopt($c, CURLOPT_URL, $base_url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
// Save location data
$csvPosition = trim(curl_exec($c));
// Close the connection
curl_close($c);
// Split pieces of data by the comma that separates them
list($httpcode,$elev, $lat, $long) = preg_split("/[,]+/", $csvPosition);
?>
<!DOCTYPE html>
<html>
<head>
<title>Geocoding Example - WinSysAdminBlog.com</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
#map_canvas { height: 512px; width: 512px; }
</style>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(<?php echo $lat; ?>, <?php echo $long; ?>);
var addressMarker = new google.maps.LatLng(<?php echo $lat; ?>, <?php echo $long; ?>);
var myOptions = {
zoom: 16,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
marker = new google.maps.Marker({ map:map, position: addressMarker });
}
</script>
</head>
<body onload="initialize()">
<h2>Geocoding Example</h2>
<div id="map_canvas"></div>
</body>
</html>
在此先感謝。 此致Sunil