forked from data-ac-uk/geo-explore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy-get.php
More file actions
27 lines (21 loc) · 742 Bytes
/
proxy-get.php
File metadata and controls
27 lines (21 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
ini_set('memory_limit','512M');
$endpoint = $_GET["endpoint"];
unset( $_GET['endpoint'] );
$entityBody = file_get_contents('php://input');
$url = add_params( $endpoint,http_build_query($_GET));
$curl=curl_init();
curl_setopt($curl,CURLOPT_URL, $url );
curl_setopt($curl,CURLOPT_POST, false );
curl_setopt($curl,CURLOPT_HTTPHEADER, array( "Content-type: text/xml" ) );
curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
//curl_setopt($curl,CURLOPT_VERBOSE, true );
$result = curl_exec($curl);
curl_close($curl);
header( "Content-type: text/xml" );
print preg_replace( '/null:/', '', $result );
exit;
function add_params( $url, $params ) {
if( preg_match( "/\?/", $url ) ) { return "$url&$params"; }
return "$url?$params";
}