mrguy123 has asked for the wisdom of the Perl Monks concerning the following question:
However, when I run this program, instead of getting the search results, I get the search page. Usually when this happens it is because of a cookie, but I couldn't find any cookies in this site. Does anybody know what the problem might be, and how I can solve it by retrieving the search results page?#!/exlibris/metalib/m4_b/product/bin/perl use strict; use LWP::UserAgent; { my $ua = new LWP::UserAgent(); my $search_address = "http://www.stat-usa.gov/nct_all.nsf/2d58b7a 34bbaa3838525703f004f804e?"; my $post = 'qAllWords=cats&qAnyWords=&qNoWords=&PostedSince=01%2F0 +1%2F2003&webcat_select=All&databases=ATL&databases=AGWORLD&databases= +MRD_CCG&databases=DLA&databases=CBD&databases=MRD_ISA&databases=MRD_I +MI&databases=MISCFILES&databases=MRD_ALL&databases=MRD_MDB&databases= +NED&databases=PUB&databases=ONLINE&databases=TOP&databases=ETO_DE&dat +abases=ETO_OF&configserver=CN%3Dstatweb01%2FOU%3Dwebserv%2FOU%3Dstate +sa%2FO%3Dstatdoc&configpath=nct_config5.nsf&webcategories=All&header= +&footer=&disp_header=&disp_footer=&saveoptions=0&query=AND+%28%5BdUpd +ate%5D+%3E+01%2F01%2F2003%29'; #creating the request object my $header = new HTTP::Headers(); my $req = new HTTP::Request ('POST', $search_address, $header, $po st); #sending the request my $res = $ua->request($req); if (!($res->is_success)){ warn "Warning:".$res->message."\n"; } print $res->as_string."\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Retrieving web pages with the LWP::UserAgent
by b10m (Vicar) on Sep 06, 2006 at 13:26 UTC | |
by mrguy123 (Hermit) on Sep 06, 2006 at 13:32 UTC | |
by b10m (Vicar) on Sep 06, 2006 at 13:35 UTC | |
|
Re: Retrieving web pages with the LWP::UserAgent
by davorg (Chancellor) on Sep 06, 2006 at 13:15 UTC | |
by bart (Canon) on Sep 07, 2006 at 09:28 UTC | |
by mrguy123 (Hermit) on Sep 06, 2006 at 13:30 UTC | |
|
Re: Retrieving web pages with the LWP::UserAgent
by Fletch (Bishop) on Sep 06, 2006 at 13:18 UTC | |
|
Re: Retrieving web pages with the LWP::UserAgent
by planetscape (Chancellor) on Sep 07, 2006 at 16:17 UTC | |
by RyuMaou (Deacon) on Dec 30, 2014 at 14:39 UTC |