papaface Posted December 31, 2007 Share Posted December 31, 2007 Hello, How can I check if a remote link returns a 404 error? I understand it has something to do with headers but I'm not entirely sure. Any help would be appreciated! Quote Link to comment Share on other sites More sharing options...
papaface Posted December 31, 2007 Author Share Posted December 31, 2007 I have this: <?php $url = "http://video.stage6.com/1957687/.divx"; $valid = fsockopen("$url", 80, $errno, $errstr, 30); if ($valid) echo "active"; else echo "dead"; ?> I'm trying to test whether or not a link is still active or not. The code above doesn't work because that link forces a download. A unactive link shows a 404 error on the page. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.