Jump to content

Processing large file


Exoon

Recommended Posts

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 />";
    }

}

?>

Link to comment
https://forums.phpfreaks.com/topic/210994-processing-large-file/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.