Skip to content

Instantly share code, notes, and snippets.

@tncbbthositg
Created July 27, 2009 20:43
Show Gist options
  • Save tncbbthositg/156731 to your computer and use it in GitHub Desktop.
Save tncbbthositg/156731 to your computer and use it in GitHub Desktop.
<?php
$url = $_POST["ajaxproxy_url"];
unset($_POST["ajaxproxy_url"]);
if (isset($_POST["ajaxproxy_unpw"]))
{
$unpw = $_POST["ajaxproxy_unpw"];
unset($_POST["ajaxproxy_unpw"]);
}
$post = '';
$get = '';
foreach($_POST as $key => $value)
$post .= "&$key=$value";
$get = $_SERVER["QUERY_STRING"];
$url .= "?$get";
$ch = curl_init($url);
if ($post != '')
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
if (isset($unpw))
curl_setopt($ch, CURLOPT_USERPWD, $unpw);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment