Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LWP connection errors

Status
Not open for further replies.

sedawk

Programmer
Feb 5, 2002
247
US
Hi,

The following code get a 500 error:
500 Can't connect to (connect: Connection refused). Do I need to have connection permission before using LWP or need to use different port number?

Thanks,

Code:
my $ua = new LWP::UserAgent;
$ua->agent("hcat/1.0");
my $request = new HTTP::Request("GET", "[URL unfurl="true"]http://www.yahoo.com");[/URL]
my $response = $ua->request($request);
                                                        
if ($response->is_success) {
        print $response->content;
}
else
{
        print $response->status_line, "\n";
}
 
Your code works for me, (after adding "use LWP::Useragnet;") but I do have to disable my firewall first when running it from my local pc.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
As Miller notes, yahoo has APIs you should be using to interact with their website. I would look into the link(s) he posted.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I guess firewall is the issue. Is a way to handle the firewall using LWP?

Thanks
 
Read the LWP documentation.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top