danke, für die antwort
ich weiß dass doctype sein muss, darum brauch ich ja auch ein lösung.
api v3!
link hab ich keinen weil das ganz biss jetzt nur auf meinem server läuft.
aber auch in einer absoluten mini-variante (also nur karte aufrufen) muss ich doctype entfernen damit die karte angezeigt wird!
so funkts:
<?php
session_start();
$delay = 0;
$base_url = "
http://maps.google.com/maps/geo?output=xml";
// Iterate through the rows, geocoding each address
$address = $_Session['add'];
$request_url = $base_url . "&q=" . urlencode($address);
$xml = simplexml_load_file($request_url) or die("url not loading");
$status = $xml->Response->Status->code;
if (strcmp($status, "200") == 0) {
// Successful geocode
$geocode_pending = false;
$coordinates = $xml->Response->Placemark->Point->coordinates;
$coordinatesSplit = explode(",", $coordinates);
// Format: Longitude, Latitude, Altitude
$lat = $coordinatesSplit[1];
$lng = $coordinatesSplit[0];
// sent geocodes too fast
$delay += 100000;
} else {
// failure to geocode
$geocode_pending = false;
echo "Address " . $address . " failed to geocoded. ";
echo "Received status " . $status . "\n";
}
usleep($delay);
?>
<html>
<head>
<script type="text/javascript" src="
https://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
window.onload = function() {
var latlng = new google.maps.LatLng(<?php echo $lat.",".$lng ?>);
var myOptions = {
zoom: 15,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var marker = new google.maps.Marker({
position: latlng,
title:"Hello World!"
});
marker.setMap(map);
}
</script>
</head>
<body>
<div id="map_canvas" style="width:400; height:300"></div>
</body>
</html>
so funkts nicht:
<?php
session_start();
$delay = 0;
$base_url = "
http://maps.google.com/maps/geo?output=xml";
// Iterate through the rows, geocoding each address
$address = $_Session['add'];
$request_url = $base_url . "&q=" . urlencode($address);
$xml = simplexml_load_file($request_url) or die("url not loading");
$status = $xml->Response->Status->code;
if (strcmp($status, "200") == 0) {
// Successful geocode
$geocode_pending = false;
$coordinates = $xml->Response->Placemark->Point->coordinates;
$coordinatesSplit = explode(",", $coordinates);
// Format: Longitude, Latitude, Altitude
$lat = $coordinatesSplit[1];
$lng = $coordinatesSplit[0];
// sent geocodes too fast
$delay += 100000;
} else {
// failure to geocode
$geocode_pending = false;
echo "Address " . $address . " failed to geocoded. ";
echo "Received status " . $status . "\n";
}
usleep($delay);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="
https://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
window.onload = function() {
var latlng = new google.maps.LatLng(<?php echo $lat.",".$lng ?>);
var myOptions = {
zoom: 15,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
var marker = new google.maps.Marker({
position: latlng,
title:"Hello World!"
});
marker.setMap(map);
}
</script>
</head>
<body>
<div id="map_canvas" style="width:400; height:300"></div>
</body>
</html>