[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] Can a cgi script call an URL?



>Do I understand correctly, then, in assuming that I can make a script do:
>
>print "Location: www.domain.com/cgi-bin/next.cgi? this=that&foo=fee\n\n"

print "Location:
http://www.domain.com/cgi-bin/next.cgi/http://www.mastercall.com/g-s/?this=that&;
foo=fee\n\n";


 $ENV{'QUERY_STRING'} would contain
    this=that&foo=fee

 $ENV{'PATH_INFO'} would contain
    /http://www.mastercall.com/g-s/


Try these 3 steps...

1) Save the following script as env_var.cgi.

#!/usr/local/bin/perl5

alarm(15);

print "Content-type: text/html\n\n";

print <<"EOF";
<html>
<head> <title> Environment Variables </title> </head>
<center>
<table border=2 cellpadding=10 cellspacing=10>
<tr><th align=left><h3>Environment Variable</h3>
<th align=left> <h3>Contents </h3></tr>
EOF

foreach $var (sort keys(%ENV)) {
    print "<tr><td> $var </td><td> $ENV{$var} </td></tr>";
}

print "</table></center></body></html>";

__END__


2) Save the following script as pass.cgi.

#!/usr/local/bin/perl5

alarm(15);

print "Location:
http://www.domain.com/cgi-bin/env_var.cgi/http://www.mastercall.com/g-s/?this=th
at&foo=fee\n\n";

__END__


3) Type http://www.domain.com/cgi-bin/pass.cgi into the location bar in
your browser.


HTH,
David Seay
http://www.mastercall.com/g-s/





==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org