Re: Checking URLS across a cluster.
Paul Bijnens <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.lwp |
|---|---|
| Message-ID | <[email protected]> |
On 2006-04-10 16:08, J.Slee wrote:
>
> I have just been thinking about that, but I am looking at doing this for
> about 20 - 30 sites and modifying the hosts file and probably doing a
> flush of the DNS cache between each check is a little heavy handed. I
> was rather hoping there was some method in the LWP module to direct the
> GET request to a specific IP address, rather than letting it work it out
> for itself from the supplied URL.
And more low level using Net::HTTP:
use Net::HTTP;
foreach $ip ("192.168.0.100", "192.168.0.101") {
my $s = Net::HTTP->new(Host => $ip);
$s->write_request(
GET => "http://myhostsite.domain/mypage",
# Other options if needed
);
my ($code, $mess, %h) = $s->read_response_headers;
print "Host: ", $s->host, " answered with code $code\n";
}
--
Paul Bijnens, xplanation Technology Services Tel +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM Fax +32 16 397.512
http://www.xplanation.com/ email: [email protected]
***********************************************************************
* I think I've got the hang of it now: exit, ^D, ^C, ^\, ^Z, ^Q, ^^, *
* F6, quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt, abort, hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e, kill -1 $$, shutdown, *
* init 0, kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... *
* ... "Are you sure?" ... YES ... Phew ... I'm out *
***********************************************************************