I have for example the following URL:
index.php?q=Content/Uploads/Images/1.jpg
I want so that page will return t开发者_运维知识库he 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?
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.
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:password@example.com/
* Supports both Curl and Fsockopen. Tries to use curl - if it is not available, users fsockopen.
* Secure URL(https) supported with Curl
精彩评论