Mosley has asked for the wisdom of the Perl Monks concerning the following question:
use LWP::Simple; if ($ENV{'QUERY_STRING'}) { $buffer = $ENV{'QUERY_STRING'}; } else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/\n/ /g; $FORM{$name} = $value; } print "Content-type: text/html\n\n"; $URL = $FORM{'url'}; $page = get($URL); $page =~ s/\s+/ /g; # I do more with the $page varaible later but I break it off here. # Strip most of the HTML, <script>, <style> and punctuation. # I think it's greedy. Any help? I perfer without perl module? $break = $page; $break =~ tr/A-Z/a-z/; $break =~ s/ \;/ /g; $break =~ s/<s.*?<\/s.*?>//igs; $break =~ s/<\;//igs; $break =~ s/>\;//igs; if(!($break)) { &error; &print_footer; exit; } &print_main_header; ($text = $break) =~ s/<(\/|!)?[-.a-zA-Z0-9]*.*?>//g; $text =~ s/[,.?':!"@#\$\%&*()_|\/\-=+\^~`\{\}\[\]\\]//g; $text =~ s/\s+/ /g; @text = split(/\s/, $text);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Check remote file for size?
by pjf (Curate) on Oct 13, 2001 at 12:22 UTC | |
|
Re: Check remote file for size?
by thinker (Parson) on Oct 13, 2001 at 13:27 UTC | |
by Mosley (Novice) on Oct 13, 2001 at 15:15 UTC |