Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Checking URLS across a cluster.: msg#00021

lang.perl.modules.lwp

Subject: Re: Checking URLS across a cluster.

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>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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