Solved

Perl LWP Proxy

Posted on 2007-12-03
6
4,147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans

630 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