|
|
Choosing A Webhost: |
Re: Checking URLS across a cluster.: msg#00021lang.perl.modules.lwp
Paul Bijnens <paul.bijnens@xxxxxxxxxxxxxx> writes: > 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"; > } This out to work as well (untested): #!/usr/bin/perl -w use LWP::UserAgent; my $ua = LWP::UserAgent->new; foreach $ip ("192.168.0.100", "192.168.0.101") { my $res = $ua->get("http://$ip/mypage", Host => "myhostsite.domain"); print "Host: $ip answered with code ", $res->code, "\n"; } Regards, Gisle
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Checking URLS across a cluster., Mark Suter |
|---|---|
| Next by Date: | Large-scale spidering, Marvin Humphrey |
| Previous by Thread: | Re: Checking URLS across a cluster., Paul Bijnens |
| Next by Thread: | RE: Checking URLS across a cluster., J.Slee |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |