'); // Curl headers. $headers = array('Expect:'); // Is it a POST or a GET? if( $_SERVER["REQUEST_METHOD"] == "GET" ) $Query = $_GET; if( $_SERVER["REQUEST_METHOD"] == "POST" ) $Query = $_POST; // Concatenate the query values. $HashedQuery = ""; foreach( $Query as $key => $value ) { $HashedQuery .= $value; } $HashedQuery .= SignatureKey; // Compute the hash. $Signature = md5($HashedQuery); // Build the new query string. $url = ImageNavigatorServer; $qs = ""; foreach( $Query as $key => $value ) { $qs .= $key.'='.urlencode($value).'&'; } // Add the Signature. $qs .= "ds=".$Signature; // Open the Curl session $ch = curl_init(); // Return response headers and body. switch( $_SERVER['REQUEST_METHOD'] ) { case "GET": curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, $url.$qs); break; case "POST": curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $qs); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, $url); break; default: exit(-1); } // Make the call $response = curl_exec($ch); // Split the headers from the body. list($response_headers, $response_body) = explode("\r\n\r\n", $response, 2); // Break up the headers. $response_header_lines = explode("\r\n", $response_headers); // Get the HTTP status code. $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); // Return the response if the status is 200. switch( $httpcode ) { case 200: // Output the headers. foreach($response_header_lines as $hd) { header($hd); } // Output the body. echo $response_body; break; default: header("HTTP/1.0 ".$httpcode); break; } // Close the curl handle. curl_close($ch); exit(0); ?>