PHP as web proxy ?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I need to use a PHP app as a sort of a web proxy
To be more specific:

I have a mailserver with own web server and web interface. What  want it to
be able to dynamically change its output pages (but I cannot interface
directly PHP with its web browser)

So, suppose the web mail server runs on

and I have my site at

What I need is user to connect to , and when my PHP webserver
receive this request, it will request the page from . Then it will make some processing on the
returned HTML page (like changing CSS, adding banners, rewrite form's Action
parameter, etc), and will return this page to client.

When client will post a page (like clicking on a submit button), my php page
will receive it, and pass it to original action URL together with all
POST-ed data

Any thoughts how t do this?


Re: PHP as web proxy ?

Bogdan Zamfir wrote:
Quoted text here. Click to load it
err... something like:


foreach($_POST as $name=>$val) {
        $params.=$name . '=' . urlencode($val) . '&';
$in=file_get_contents(" ?$params");
print $out;

If you want to POST to the back-end, you'll need a lot more code.



Re: PHP as web proxy ?

Quoted text here. Click to load it
Actually, similarly to this I am behind a firewall here at work.... :$

I have idly wondered whether something like this could be put together to
stop the firewall banning certain domains (like my webmail),  and possibly
even allowing data to be forwarded through to another protocal? For example,
connecting to an IMAP server where the IMAP ports are blocked on the

Any ideas?

Site Timeline