Re: Writting a simple proxy in PHP
| From: | Jochem Maas | Date: | Tue, 06 Feb 2007 11:40:59 +0000 |
| Subject: | Re: Writting a simple proxy in PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248423@lists.php.net to get a copy of this message | ||
Alessandro Vernet wrote:
> I would like to forward on the server side (also called "proxy" or
> "server-side redirect") some queries that get to my PHP script. A naive
> approach is to do:
>
> print(implode("", file("http://localhost:8090"ÄQ‰ÔíšËÁà?*¼]
> ¡^ . $REQUEST_URI)));
>
> Where http://localhost:8090 is the address I want to proxy to.
> But of
> course, this only works for simple GET requests. It does not forward headers
> (like Authentication), and won't work if the request is a POST.
>
> Has anyone a suggestion on how I could implement a better proxy? I am not
> looking for a perfect solution. Something that would forward headers and
> handle posts would be good enough.
if your using apache then you should look at the ProxyPass directive - very hand,
STW or STA for more detailed info.
>
> Alex