tags:

views:

53

answers:

2

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?

A: 

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
Jeff Paquette
I tried: print_r(load('http://sstatic.net/so/img/logo.png' )); but it writes "Client browser does not accept the MIME type of the requested page."
TTT
+1  A: 

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.

Gabri van Lee
How can I get the headers of the remote page?
TTT