On 5/13/09 Wed May 13, 2009 2:17 PM, "ANJAN PURKAYASTHA" <anjan.purkayas...@gmail.com> scribbled:
> Hi, > Here is a beginner's LWP code that is not working. The script is supposed to > query the NCBI website with a user defined term: tuberculosis. The term is > entered into a search box. The user chooses a database from a drop-down menu > and then hits the Search button. > Here is the code: > #!/usr/bin/perl -w > use strict; > use LWP; > > my $query= "tuberculosis"; > my $option= "30"; > my $go= "Go"; > my $site= "NcbiHome"; > my $ua= LWP::UserAgent->new; > my $response= $ua->post('http://www.ncbi.nlm.nih.gov/', > [ > "term"=> $query, > "db"=> "4", # use the Genome database (value=4) > "submit"=> "Go", > "SITE"=> "NcbiHome" > ] > ); > > if ($response->is_success) { > print $response->content()."\n"; # or whatever > } > else { > die $response->status_line; > } > > All this script returns is the NCBI homepage. Try using the URL of the CGI program that processes the form on that page: <http://www.ncbi.nlm.nih.gov/coreutils/dispatch.cgi> -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/