CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
How do i finde broken links?

 



mICKE
Deleted

Dec 20, 2000, 4:43 AM

Post #1 of 2 (823 views)
How do i finde broken links? Can't Post

Hi.. i got a file search engin. And i am trying to do a program thats deleting all the broken links.. How do i do?
Please help me..



sigma
stranger

May 16, 2001, 5:41 AM

Post #2 of 2 (788 views)
Re: How do i find broken links? [In reply to] Can't Post

#!/usr/bin/perl

use LWP::UserAgent;

sub checklink {
my ($url) = @_;
my $agent = new LWP::UserAgent;
my $request = new HTTP::Request HEAD => $url;

my $result = $agent->request($request);

if ($result->is_error) {
return "Error: ".$result->status_line;
} else {
return "OK: $url";
}
}

print checklink('http://www.steve.sk'), "\n";


driven by perl...

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives