Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: checking a url to make sure it works

by jweed (Chaplain)
on Feb 20, 2004 at 07:00 UTC ( [id://330481]=note: print w/replies, xml ) Need Help??


in reply to checking a url to make sure it works

$content = get($url); $error = 1 unless (defined $content);
should work from source code examinations, but if it doesn't this roundabout method ought to:
use HTTP::Request; use LWP::UserAgent; my $ua = new LWP::UserAgent; my $request = HTTP::Request->new(GET => $url); my $response = $ua->request($request); $error = 1 unless ($response->is_success);



Code is (almost) always untested.
http://www.justicepoetic.net/

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://330481]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-24 19:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found