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: Intermediate:
External Link Verification

 



benchivers
Novice

Sep 23, 2002, 7:24 AM

Post #1 of 5 (517 views)
External Link Verification Can't Post

Hi,

I am trying to create an external link verification program, I have created it so that it checks all of the internal links, but how can I check an external link? What function do I use?

e.g checking the whether the following URL really does exist:
http://www.benchivers.co.uk/index.html

Any help would be most appreciated!

Many Thanks in Advanced,
Ben Chivers
Wheres the damn coffee? zzzZZZZZ!!!


davorg
Thaumaturge / Moderator

Sep 23, 2002, 11:06 AM

Post #2 of 5 (514 views)
Re: [benchivers] External Link Verification [In reply to] Can't Post

Easiest way is probably to use the "head" function from LWP::Simple.

Code
foreach (@urls) { 
if (head $_) {
print "$_ is active\n";
} else {
print "$_ is dead\n";
}
}


--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


benchivers
Novice

Sep 23, 2002, 1:27 PM

Post #3 of 5 (512 views)
Re: [davorg] External Link Verification [In reply to] Can't Post

Thanks for the reply Dave, but is there anyway to test the external link without having any special modules installed on the web server, is there a simple gethost function or something similar which will work?

Cheers,
Ben Chivers
Wheres the damn coffee? zzzZZZZZ!!!


davorg
Thaumaturge / Moderator

Sep 23, 2002, 1:33 PM

Post #4 of 5 (511 views)
Re: [benchivers] External Link Verification [In reply to] Can't Post

I'm afraid that is the simple function :)

Installing the LWP modules is your best bet.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


benchivers
Novice

Sep 24, 2002, 2:38 PM

Post #5 of 5 (503 views)
Re: [davorg] External Link Verification [In reply to] Can't Post

Ok, Cheers
Wheres the damn coffee? zzzZZZZZ!!!

 
 


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

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