Re: Redirecting internally
Re: Redirecting internally
- Subject: Re: Redirecting internally
- From: Zak Burke <email@hidden>
- Date: Thu, 21 Jul 2005 22:02:34 -0400
Eric Stewart wrote on 7/21/05 5:19 PM:
> I'm currently converting a script originally in cgi to WO. The server
> gets requests something similar to this
> http://www.example.com/cgi-bin/script.cgi?a=1&b=2.
>
> I need that to be internally redirected to
> http://www.example.com/cgi-bin/WebObjects/Script.woa/wa/action?a=1&b=2
bounce the browser from the CGI to the WO page:
#!/usr/local/bin/perl
print "Location: http://...wa/action?$ENV{'QUERY_STRING'}\n\n";
or grab content from the new page, but display it as though
http://www.example.com/cgi-bin/script.cgi?a=1&b=2 itself generated the
content:
#!/usr/local/bin/perl
use strict;
use LWP;
main();
sub main
{
print "Content-type: text/html\n\n";
my $ua = LWP::UserAgent->new();
my $url = "http://.../Script.woa/wa/action?$ENV{'QUERY_STRING'}";
my $res = $ua->get($url);
if ( $res->is_success ) {
print $res->content;
} else {
print "ERROR retrieving $url: " . $res->status_line();
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden