
chandar
New User
Apr 20, 2010, 6:37 AM
Post #1 of 1
(1217 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.
#!/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
#!/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
|