1

I write this code :

 #!/usr/local/bin/perl
 use strict;
 use LWP::UserAgent;

 my $ua = new LWP::UserAgent(agent => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5');
 $ua->proxy([qw(http https)] => 'http://203.185.28.228:1080' #that is just socks:port);
 my $response = $ua->get("http://www.google.com");
 print $response->code,' ', $response->message,"\n";

but when i execute it i get this error: 500 Can't connect to 203.185.28.228:1080 (connect: timeout)

what am i going to do ?

1
  • First, use -w OR 'use warnings'. Next: What about your internet connectivity. is that working fine? Commented May 11, 2010 at 10:13

2 Answers 2

1

I tested your script, its fine, however I got the only error is with

$ua->proxy([qw(http https)] => 'http://203.185.28.228:1080' #that is just socks:port);

The comments should be out of '()' i.e.

$ua->proxy([qw(http https)] => 'http://203.185.28.228:1080'); #that is just socks:port

Also, please check your internet connectivity. Below is the output i got from your script.

200 Assumed OK
Sign up to request clarification or add additional context in comments.

Comments

0

Is it SOCKS5? Does it require you to authenticate? (take a look at your Firefox/IE settings if they use the same proxy)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.