in reply to Check if URL exists
So in your example to set a timeout of 10:
use LWP::Simple qw($ua head); $ua->timeout(10); my $url = 'http://www.domain.com/'; if (head($url)) { print "Does exist\n"; } else { print "Does not exist or timeout\n";; }
NB: LWP::Simple's head() and get() functions do not distinguish between 'not exists' and 'timeout', it returns similar for both situations.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Check if URL exists
by sivel (Initiate) on Jun 04, 2007 at 17:50 UTC |