Skip to content

Instantly share code, notes, and snippets.

@LucianoCharlesdeSouza
Created July 5, 2020 21:15
Show Gist options
  • Save LucianoCharlesdeSouza/664e83f1769b523565ecc48a1b1be991 to your computer and use it in GitHub Desktop.
Save LucianoCharlesdeSouza/664e83f1769b523565ecc48a1b1be991 to your computer and use it in GitHub Desktop.
<?php
function httpGet(string $url, array $headers = [])
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER =>$headers,
));
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
$apiKey = 'your-key-here';
$endPoint = "https://image.maps.ls.hereapi.com/mia/1.6/mapview?apiKey={$apiKey}&lat=-26.900972&lon=-48.934947&vt=0&z=14";
header('Content-Type: image/png');
echo httpGet($endPoint);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment