tame1 has asked for the wisdom of the Perl Monks concerning the following question:
From the code above you can see the actual site and page I am trying to steal from. If anyone can enlighten me as to what is wrong (what I have done wrong) I would greatly appreciate it, as this has taken 3 hours of my time and made me feel very stupid. I am using perl 5.8.6.#!/usr/bin/perl use strict; use Net::HTTP; use HTML::Strip; use LWP::Simple; my $DOMAIN="www.fentonchamber.org"; my $MAIN_LIST="AlphabeticalListing.asp"; my $HOMEDIR="/home/jrobiso2/Documents/CDS/Chamber/"; my $list_file="/tmp/AlphabeticalListing.html"; my @listing; ### Get initial listing of data from the main page. open(SRC, "+>$list_file") or die "Cannot open file: $!\n"; my $http = Net::HTTP->new(Host => $DOMAIN) || die $!; $http->keep_alive; $http->write_request(GET => "/$MAIN_LIST", 'User Agent' => "Mozilla/5. +0"); my($code, $mess, %h) = $http->read_response_headers; ## Build the listing of company numbers from the javascript window.ope +n ## calls inside the main listing html page. while (1) { my $buf; my $n = $http->read_entity_body($buf, 1024); die "read failed: $!" unless defined $n; last unless $n; # if ($buf =~ /ID=([0-9]+)/) { # OLD CODE # push @listing, $1; # THAT FAILED # } # print SRC $buf; } close(SRC); open(SRC, "<$list_file") || die "Cannot open file: $!\n"; while (<SRC>) { if (/ID=([0-9]+)/) { push @listing, $1; } } @listing = sort @listing;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Strange regex behavior
by BrowserUk (Patriarch) on Aug 14, 2005 at 21:15 UTC | |
by Bob9000 (Scribe) on Aug 14, 2005 at 21:33 UTC | |
Re: Strange regex behavior
by Tanktalus (Canon) on Aug 14, 2005 at 21:46 UTC | |
Re: Strange regex behavior
by insaniac (Friar) on Aug 14, 2005 at 21:16 UTC | |
by tame1 (Pilgrim) on Aug 14, 2005 at 21:58 UTC | |
by tame1 (Pilgrim) on Aug 14, 2005 at 21:22 UTC | |
Re: Strange regex behavior - beware chunk boundaries!
by dws (Chancellor) on Aug 15, 2005 at 03:24 UTC |