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.
Any idea what I am doing wrong?
TIA,
Anjan
--
=============================
anjan purkayastha, phd
bioinformatics analyst
whitehead institute for biomedical research
nine cambridge center
cambridge, ma 02142
purkayas [at] wi [dot] mit [dot] edu
703.740.6939