NAME

HTTP::ProxyCheck - Checks HTTP proxy servers.

SYNOPSIS

CHECK HTTP PROXY

use HTTP::ProxyCheck;

# $OUTPUT_AUTOFLUSH
$| = 1;

my $proxycheck = new HTTP::ProxyCheck();
my $proxy = "10.0.0.1:8080";
my $url = "http://www.perl.org/index.shtml";

print "Trying to connect to $proxy and retrieve $url\n";

if ($proxycheck->check(proxy=> "$proxy",url=> "$url",answer=>"header")) {
	print "$proxy returns: " . $proxycheck->get_answer() . "\n";
}
else {
	print "Error (" . $proxycheck->get_reason() . ")\n";
}

CHECK PROXY ADDRESS

use HTTP::ProxyCheck;

my $proxycheck = new HTTP::ProxyCheck();
my $proxy = "10.0.0.1:8080";

print "Checking proxy address $proxy\n";

if ($proxycheck->check_address($proxy) {
	print "$proxy is a valid proxy address\n";
}
else {
	print "Error (" . $proxycheck->get_reason() . ")\n";
}

DESCRIPTION

HTTP::ProxyCheck is a class to check HTTP proxy servers. It connects to given HTTP proxy servers and tries to retrieve a provided URL through them. You can also use HTTP::ProxyCheck to check wether the syntax of a proxy address may be valid without connecting to a server.

The return message from the proxy servers can be accessed through the get_answer method.

Whenever a check fails, you can access the reason through the get_reason method.

METHODS

check( proxy => $proxy, url => $url, answer => $type )

The check method is used to check a HTTP proxy server. The check method includes a test to check the syntax of the provided proxy server address (check_address) and URL. You can specify wether you want to get only the header ($type = "header") or the full page ($type = "full") as return value from the method. This specification is optionally. The default answer is $type = "header".

check_address( $proxy )

The check_address method is used to check for a valid proxy server address. When you use check the proxy address is checked with this method automatically.

get_answer( )

Through the get_answer method the return message from the proxy servers can be accessed.

get_reason( )

When a proxy check fails, the reason can be accessed through the get_reason method.

BUGS

Unknown

SUPPORT

Contact the author

AUTHOR

Thomas Weibel
cpan@beeblebrox.net
http://beeblebrox.net/

COPYRIGHT

Copyright (c) 2003 Thomas Weibel. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.