At Thu, 7 Nov 2002 16:46:25 +1100, Susanto Hartono wrote:
> Does anyone know how to forward http requests (not redirect) using CGI?
> Doing it in Java is pretty straightforward but I am not sure how to do it in
> Perl. CGI::Base and LWP look promising on the surface but don't seem to do
> what I want (on further investigation).
something like (untested, you might actually have to think):
#!/usr/bin/perl
use LWP::UserAgent;
use strict;
use warnings;
my $ua = new LWP::UserAgent timeout => 30;
my $response = $ua->get('http://www.slug.org.au/');
# we don't care if it worked or not, we just pass the result straight
# through
print $response->headers_as_string, "\n", $response->content;
exit 0;
that should get you started. ask if you have any other questions.
(from memory, there's an apache "reverse proxy" module which probably
does exactly what you want)
--
- Gus
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug