Plankton has asked for the wisdom of the Perl Monks concerning the following question:
I want to be able to logon via this URL ...#!/usr/local/bin/perl -w use strict; + + use WWW::Mechanize; use CGI; my $cgi = new CGI; my $mech = WWW::Mechanize->new(); my $scriptName = $ENV{'SCRIPT_NAME'} || $0; my ( $requestURI, $QS ) = split /\?/, $ENV{'REQUEST_URI'} || $0; my $url = $cgi->param('url') || 'http://localhost/'; $mech->get( $url ); my $content = $mech->content; $content =~ s/<HTML>//ig; $content =~ s/<\/HTML>//ig; $content =~ s/<BODY>//ig; $content =~ s/<\/BODY>//ig; my @lines = split /\n/, $content; print $cgi->header (); print "<base href=$url>\n"; print $cgi->start_html( "WAY $scriptName" ); for my $line (@lines) { if ( $line =~ /a href/i ) { if ( $line =~ /<a href=(['"])http/i ) { $line =~ s/<a href=(['"])/<a href=$1http:\/\/l +ocalhost\/cgi-bin\/way.pl?url=/ig; } else { $line =~ s/<a href=(['"])/<a href=$1http:\/\/l +ocalhost\/cgi-bin\/way.pl?url=$url/ig; } } print $line; } print "<!-- \n"; while ( my ($key, $val) = each %ENV) { print "$key = $val\n"; } print "-->\n"; print $cgi->end_html;
... and of course be able to play some chess once i logon.http://localhost/cgi-bin/way.pl?url=http://www.itsyourturn.com/iyt.dll +?status?p=1
| Plankton: 1% Evil, 99% Hot Gas. |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Site Blocker Work Around CGI help
by tachyon (Chancellor) on Jul 01, 2004 at 05:40 UTC | |
|
Re: Site Blocker Work Around CGI help
by bart (Canon) on Jul 01, 2004 at 07:18 UTC | |
by Grygonos (Chaplain) on Jul 01, 2004 at 12:45 UTC | |
by arden (Curate) on Jul 01, 2004 at 15:13 UTC |