Created
November 22, 2011 04:53
-
-
Save therealklanni/1384925 to your computer and use it in GitHub Desktop.
Stupidly simple PHP proxy
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 | |
// Stupidly simple PHP proxy for AJAX (HTTP GET) requests. Written by Kevin Lanni. | |
$dest = ''; // Set to the remote script URL (i.e. http://remotehost.com/some.php) | |
$a = array(); | |
foreach ($_GET as $k=>$v) { | |
$a[] = "{$k}={$v}"; | |
} | |
echo file_get_contents($dest.'?'.implode('&',$a)); | |
?> |
...
<?php
$dest = '';
echo file_get_contents($dest.'?'.$_SERVER['QUERY_STRING']);
?>
Thanks, those are some pretty good ideas. Feel free to fork this gist :)
I'll try your methods out when I have a little time to play around and then update my gist.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
....or even simpler:
;-)