Weatherscan/webroot/js/leaflet/proxy.php
2018-09-11 23:33:44 -04:00

20 lines
520 B
PHP

<?php
$url = $_GET['url'];
$result = "";
if (strpos($url, "GetCapabilities") >= 0){
$result = file_get_contents($url);
$nlines = count($http_response_header);
for ($i = $nlines-1; $i >= 0; $i--) {
$line = $http_response_header[$i];
if (substr_compare($line, 'Content-Type', 0, 12, true) == 0) {
$content_type = $line;
break;
}
}
header($content_type);
echo $result;
} else{
header('HTTP/1.0 400 Bad Request');
echo 'Request not valid';
}
?>