URL Link Tester

Description

Originally presented by Niel at the Apple Forum, this subroutine will let you do a quick test of whether a given URL link is working.

The Code

on verify_Link(theURL)
    --Originally presented by Niel at http://discussions.apple.com/message.jspa?messageID=10726800
    set the_page to do shell script "curl -si " & theURL & ""
    set the_code to items 10 thru 12 of the_page as string
    set the_offset to offset of "<title" in the_page
    set the_title_1 to items (the_offset + 7) thru (the_offset + 300) of the_page as string
    set the_offset_2 to offset of "</title" in the_title_1
    set the_title_2 to items 1 thru (the_offset_2 - 1) of the_title_1 as string
end verify_Link