Revision of 28th Sept (Fri) Cross domain ajax POST proxy php file from Fri, 2012-09-28 15:58

As discussed yesterday,
this is the php file that can act as a proxy to post cross domain for you:

<?php
$ch = curl_init($_GET['url']);
unset($_GET['url']);
$data_string = http_build_query($_GET);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string))
);

$result = curl_exec($ch);
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
echo $result;

Pass in extra url params as query string, it will post to that URL, while not sending the URL to remote server.

Google