API: staticmap

<?php
header('Access-Control-Allow-Origin: *');

$key = $_REQUEST['key'];	// Replace with $key = YOUR_API_KEY


$center = $_REQUEST['center'];
$markers = $_REQUEST['markers'];
$zoom = $_REQUEST['zoom'];
$size = $_REQUEST['size'];
$format = $_REQUEST['format'];

if($center == '') $center = "37.4220147,-122.0840693";	// defaults to Googleplex
if($markers == '') $markers = "color:red|$center";
if($zoom == '') $zoom = "15";
if($size == '') $size = "400x400";
if($format == '') $format = "jpg";

if($key>'')
{
	$url="https://maps.googleapis.com/maps/api/staticmap?key=$key";

	$url .= "&center=$center&markers=$markers&zoom=$zoom&size=$size&format=$format";

	$ch = curl_init($url); 
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

	$out = curl_exec($ch);
	curl_close($ch);

	header('Content-Type: image/jpeg');
	echo $out;
}
?>