Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I agree with Olafur, but alternatively if you haven't got access to a database you could use the server's file system to save the stats of an URL in a combined config/log file, like a comma-delimited file. Let's say you have a file like this:</p> <pre><code>rapidshare.com,You want to download the file,0,0 megaupload.com,Please enter,0,0 megashares.com,Filename:,0,0 </code></pre> <p>The four fields are 'URL', 'text to check for', 'last check result' and 'has mail been sent'. The code could be something like this:</p> <pre><code>$file = "myfile.txt"; // open the file $fh = fopen($filename, "r"); // read the full file contents into a string $contents = fread($fh, filesize($file)); // close the file fclose($fh); // split the string into an array of lines $lines = split("\n", $contents); // split each line into its fields for processing $i = 0; foreach ($lines as $line) { $checkarray[$i] = split(",", $line); $i++; } </code></pre> <p>Now you can cycle through the array and do whatever you want, writing back the information including the 'mail sent' status field as you go along. Use $fields[0] for the URL, $fields[1] for the text to check for, and you can read the last status with $fields[2] en the 'mail sent' status with $fields[3].</p> <pre><code>foreach($checkarray as $fields) { // insert code to do your checks here ... // write back the results $fh = fopen($filename, "w"); fwrite($fh, $fields[0] . "," . $fields[1] . "," . $working . "," . $mailsent . "\n"; fclose($fh); } </code></pre> <p>Hope this helps you on your way.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload