<?php

//$query = urldecode( $_GET[ "q" ] );
$query = urldecode( $_SERVER[ "QUERY_STRING" ] );

// Open the Curl session
$session = curl_init( $query );

// Don't return HTTP headers. Do return the contents of the call
curl_setopt( $session, CURLOPT_HEADER, false );
curl_setopt( $session, CURLOPT_RETURNTRANSFER, true );

// Make the call
$response = curl_exec( $session );
	
// Output
header( "Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept" );
header( "Access-Control-Allow-Origin: *" );
header( "Content-Type: application/json" );
echo $response;

curl_close( $session );