Reputation: 57129
I have for example the following URL:
index.php?q=Content/Uploads/Images/1.jpg
I want so that page will return the exact result of for this example:
http://www.example.com/Content/Uploads/Images/1.jpg
Note that if 'q' is an image so it should return an image, or if it is a web page so it should return the html and headers of the web page...
Is there any php script that does it?
Upvotes: 0
Views: 256
Reputation: 135
You will want to use a combination of fpassthru() and header() to do this. You can use the header command to tell the browser what kind of content will be returned (HTML or Image) and fpassthru() to actually return the data.
Upvotes: 1
Reputation: 7127
This script does what you need and more.
Features
* Easy to use.
* Supports Get and Post methods.
* Supports HTTP Basic Authentication - this will work - http://binny:[email protected]/
* Supports both Curl and Fsockopen. Tries to use curl - if it is not available, users fsockopen.
* Secure URL(https) supported with Curl
Upvotes: 0