Solved

Perl LWP Proxy

Posted on 2007-12-03
6
4,129 Views
Last Modified: 2008-03-21
I'm using LWP::UserAgent to scrape data from a site. to hide my IP i used proxy that i found from web as they let ppl use as free. but it is not working. pls guide me what is the write way to do my task. i'm attaching my sample code.
my $ua = LWP::UserAgent->new;

$ua->proxy('http', $proxy_url); ## proxy_url contains somthing like http://10.10.10.10:1234/

$ua->timeout(10);
 

## now reading the webpage

my $request = HTTP::Request->new(GET => $web_url);

my $response = $ua->request($request);

my $content = $response->content();

Open in new window

0
Comment
Question by:marchent
  • 3
  • 3
6 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 20396407
$ua->proxy('http', $proxy_url);
0
 
LVL 13

Author Comment

by:marchent
ID: 20397034
adam, i didn't understand what u mean? i already used as u mean, pls check my code snippet.

$ua->proxy('http', $proxy_url); ## proxy_url contains somthing like http://10.10.10.10:1234/

it is not working.
0
 
LVL 39

Expert Comment

by:Adam314
ID: 20397173
What is not working?  What do you get?  Do you get an error message?
Does the proxy require a username/password?
Does it work if you use a web browser, and enter the $proxy_url as a proxy in the web browser?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 13

Author Comment

by:marchent
ID: 20397293
i'm getting
500 Can't connect to 216.129.105.10:8080 (connect: Unknown error)

or sometimes connection timed out

i just used the above ip and port as proxy. user password is not requires.
0
 
LVL 39

Accepted Solution

by:
Adam314 earned 250 total points
ID: 20397419
Does that proxy work if you try to use it within a web browser?
0
 
LVL 13

Author Comment

by:marchent
ID: 20409979
anyway, i need a valid proxy i guess.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now