jbach Posted January 20, 2010 Posted January 20, 2010 Hi Can any php experts provide feedback on the following url proxy script? Initially it threw an error, saying the HTTPRequest2 class was missing. So I went to my cpanel, located that particular PHP script and tried installing it. Got an error though trying to install (Thats another issue!) <?php // First validate that the request is to an actual web address if(!preg_match("#https?://#", $_GET['path'])) { header("HTTP/1.1 404 Not found"); echo "Content not found, bad URL!"; exit(); } // Make the request $req = new HTTP_Request2($_GET['path']); $response = $req->send(); // Output the content-type header and use the content-type of the original file header("Content-type: " . $response->getHeader("Content-type")); // And provide the file body echo $response->getBody(); ?> Quote
OJB Posted January 21, 2010 Posted January 21, 2010 (edited) I am not versed in HTTPRequest2 but the preg_match I don't think will work with hashes and without a start and end delimiter. Surely it would have to be something more like: >if(!preg_match('/https?:\/\//', $_GET['path'])) { I thought hashes were used for comments. Edited January 21, 2010 by OJB Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.