Page 1 of 1
Broken Link?
Posted: Thu May 26, 2005 11:11 am
by Todd_Z
Whats the fastest way to check if a url is a broken link?
I need to keep in mind that there are redirections too, so fopen doesn't work.
Posted: Thu May 26, 2005 1:55 pm
by Chris Corbyn
PM me... You sound like you're working on something very very similar to something I did recently for a client.
Can't remember if I checked for dead links but you'll need the URL parser I posted to you (to parse any redirects into absolute URLs) and then you use fsockopen() (or curl_() if you have it) to send HTTP requests to the server and see what's returned.
Come to think of it. Reading the headers alone (i did that too) will allow you to see if it exists or not.
Posted: Thu May 26, 2005 6:03 pm
by shiznatix
i thought file_get_contents went with redirects...it was either that or curl() but i cant find my book at the moment...