Solved

Perl LWP Proxy

Posted on 2007-12-03
6
4,124 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

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 …
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

8 Experts available now in Live!

Get 1:1 Help Now