Solved

Perl LWP Proxy

Posted on 2007-12-03
6
4,132 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

776 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