Exoon Posted August 17, 2010 Share Posted August 17, 2010 Hello, Im trying to find a way to check around 500-600 links to check if they are alive. It works fine for 5-6 links but once i add more links it just times out. Is there a way i could process this so it does 1 link at a time or somthing ? <?php include("config.php"); $query = "SELECT * FROM `games` WHERE `r_fileserve` <> \"\" LIMIT 500"; $result = mysql_query($query); while($row=mysql_fetch_assoc($result)) { $link_str = file_get_contents("$row[r_fileserve]"); $pattern = '<input type="hidden" name="download" value="normal"/>'; preg_match($pattern,$link_str,$match); if ($match[0] != null) { echo "Working <br />"; } else { echo "File Down <br />"; } } ?> Quote Link to comment Share on other sites More sharing options...
ober Posted August 17, 2010 Share Posted August 17, 2010 I'm not sure that's the best way to check for valid links. You're probably hitting the script processing limit because file_get_contents can take a while depending on server load and where you are grabbing the file from. I'm not sure what the answer is, but I don't think looking for an input element on the page is the most efficient way to go about it. Quote Link to comment Share on other sites More sharing options...
Exoon Posted August 17, 2010 Author Share Posted August 17, 2010 What else can you suggest? Im checking active links on FileServe Quote Link to comment Share on other sites More sharing options...
ober Posted August 17, 2010 Share Posted August 17, 2010 A quick google search turned up this: http://stackoverflow.com/questions/244506/how-do-i-check-for-valid-not-dead-links-programatically-using-php Quote Link to comment Share on other sites More sharing options...
Exoon Posted August 17, 2010 Author Share Posted August 17, 2010 Hello, I looked at somthing like this but the problem is when a file isnt alive on FileServe the site still works, It just gives an error saying the link is no longer avilalable. Any other ideas? Quote Link to comment Share on other sites More sharing options...
ober Posted August 17, 2010 Share Posted August 17, 2010 You should be able to read that error and know your result then. 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.