Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bad image??

Status
Not open for further replies.

Zas

Programmer
Oct 4, 2002
211
US
Is there a perl function to check to see if the image url that the user supplied is a valid one, and actually works?

Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
 
From Sean Burke:

use LWP::Simple;
my $content = get $url;
die "Couldn't get $url" unless defined $content;

You could delve deeper into LWP with

use LWP;
my $browser = LWP::UserAgent->new;

my $response = $browser->get( $url );
die "Can't get $url -- ", $response->status_line
unless $response->is_success;

You get the idea :)

Barbie
Leader of Birmingham Perl Mongers
 
thank you...

Happieness is like peeing your pants.
Everyone can see it, but only you can feel the warmth.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top