Click here to get back home

Error while using LWP

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Error while using LWP Anshu 12-01-2005
Posted by Anshu on December 1, 2005, 8:06 am
Please log in for more thread options


Hi All

I am trying to get data from www.genedb.org using LWP

My code is:

my $url
='http://www.genedb.org/genedb/Dispatcher?formType=navBar&organism=All%3
A*&name=Tc00.1047053420989.10&desc=yes&submit=Search';

use LWP::Simple;
my $content = get $url;
die "Couldn't get $url" unless defined $content;
print "$content";

But its not reading the url and I am not able to get the output. Does
anyone know what mistake I m committing?

Thanks
Anshu



Posted by Jimi-Carlo Bukowski-Wills on December 5, 2005, 1:44 am
Please log in for more thread options


# Please read docs/pods for LWP::UserAgent, HTTP::Request and
HTTP::Response...
# I don't know whats wrong with your code, but the following works:


use LWP::UserAgent;

my $ua = new LWP::UserAgent();

my $url
='http://www.genedb.org/genedb/Dispatcher?formType=navBar&organism=All%3A*&name=Tc00.1047053420989.10&desc=yes&submit=Search';

my $response = $ua->get($url);

my $content = $response->content;
my $status_line = $response->status_line;

if($response->is_success){
print $content;
}
else {
print $status_line;
}


> Hi All
>
> I am trying to get data from www.genedb.org using LWP
>
> My code is:
>
> my $url
> ='http://www.genedb.org/genedb/Dispatcher?formType=navBar&organism=All%3
> A*&name=Tc00.1047053420989.10&desc=yes&submit=Search';
>
> use LWP::Simple;
> my $content = get $url;
> die "Couldn't get $url" unless defined $content;
> print "$content";
>
> But its not reading the url and I am not able to get the output. Does
> anyone know what mistake I m committing?
>
> Thanks
> Anshu
>




Similar ThreadsPosted
Error: RCPT TO: error (550 relay not permitted) February 11, 2006, 1:39 pm
GD.c: 533: error: syntax error before "void" March 24, 2006, 10:15 am
Have I an error in my POD? December 21, 2005, 6:35 pm
Deparse error July 7, 2004, 2:52 am
Out of Memory error September 12, 2004, 11:51 pm
expat error May 26, 2005, 9:01 pm
Error Installing XML::DOM October 15, 2004, 9:16 am
error with CPAN.pm October 19, 2004, 7:13 am
Error reporting in CGI May 19, 2005, 9:41 pm
DBI version error October 26, 2004, 11:49 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap