On Tue, 13 Feb 2018 10:47:42 -0600 Andy Bach <afb...@gmail.com> wrote:
> The site doesn't like 'head' requests? get works > #!/usr/bin/perl > > use strict; > use warnings; > > use LWP::Simple; > # my $url="https://shlomif.github.io/"; > my $url="http://www.notabug.org/"; > print "$url is ", ( > (! get($url)) ? "DOWN!!!!" > : "up" > ), "\n"; > > $ is_it_up.pl > http://www.notabug.org/ is up > You are right. But am afraid this is not all of it. If I test http://scripts.sil.org/OFL then I get an error but it is fine in firefox. Very strange. -- Manfred > > On Tue, Feb 13, 2018 at 5:25 AM, Manfred Lotz <ml_n...@posteo.de> > wrote: > > > Hi there, > > Somewhere I found an example how to check if a website is up. > > > > Here my sample: > > > > #! /usr/bin/perl > > > > use strict; > > > > use LWP::Simple; > > my $url="https://notabug.org"; > > if (! head($url)) { > > die "$url is DOWN!!!!" > > } > > > > Running above code I get > > https://notabug.org is DOWN!!!! at ./check_url.pl line 8. > > > > > > However, firefox shows the site works ok. > > > > > > What am I doing wrong? > > > > > > -- > > Thanks, > > Manfred > > > > -- > > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > > For additional commands, e-mail: beginners-h...@perl.org > > http://learn.perl.org/ > > > > > > > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/