Home » google staticmap php example used dynamicly performance

google staticmap php example used dynamicly performance

google staticmap php example used dynamicly performance

<?php
$geo = str_replace(‚.‘, “, $_GET[„q“]);
$geo = str_replace(‚ ‚, “, $geo);

$url = „http://maps.googleapis.com/maps/api/staticmap?center=“. $geo .“&zoom=13&size=400×200&maptype=roadmap&key=gkey“;

$url = preg_replace(‚/\s+/‘, “, $url);
$data = file_get_contents($url);
//DebugBreak();
//$data = base64_decode($data);

$im = imagecreatefromstring($data);
if ($im !== false) {
header(‚Content-Type: image/png‘);
imagepng($im);
imagedestroy($im);
}
else {
echo ‚An error occurred.‘;
}
?>

 

google staticmap php example used dynamicly performance

Print Friendly