CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
creating proxy server using Perl

 



chandar
New User

Apr 20, 2010, 6:37 AM

Post #1 of 1 (1843 views)
creating proxy server using Perl Can't Post

Hi,

I have tried creating a proxy server[server ip:127.2.3.4] using perl.


Code
#!/opt/perl/bin/perl 
use strict;
use warnings;
use HTTP::Proxy;
my $proxy = new HTTP::Proxy;
$proxy->port(3128); # the classical accessors are here!
$proxy->logfh(*STDOUT);
#$proxy->logmask(ALL);
$proxy->start;



In client system i have the following code


Code
#!/opt/perl/bin/perl 
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->proxy(http => 'http://127.2.3.4:3128');
my $response = $ua->get('http://ipaddress/CGI/Java/Serviceability?adapter=device.statistics.configuration');

if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
}



When i run this code i get the following error

500 Can't connect to 127.2.3.4:3128 (connect: Connection refused) at a.pl at line 12

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives