Created
March 16, 2012 12:13
-
-
Save bradrice/2049813 to your computer and use it in GitHub Desktop.
PHP ajax proxy code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ch = curl_init($sub_req_url); | |
$encoded = ''; | |
// include GET as well as POST variables; your needs may vary. | |
foreach($_GET as $name => $value) { | |
$encoded .= urlencode($name).'='.urlencode($value).'&'; | |
} | |
foreach($_POST as $name => $value) { | |
$encoded .= urlencode($name).'='.urlencode($value).'&'; | |
} | |
// chop off last ampersand | |
$encoded = substr($encoded, 0, strlen($encoded)-1); | |
curl_setopt($ch, CURLOPT_URL, "http://train-new.uakron.edu/global/ajax/ua-cool-detail.dot"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $encoded); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_exec($ch); | |
curl_close($ch); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment