Jump to content

My Php Proxy Script..request Feedback


jbach

Recommended Posts

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();

?>

Link to comment
Share on other sites

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 by OJB
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...