0

I have made a PHP file which checks some words in a list [1000 or more ]. I got the source code from another script.

Example

mysite.com?key=word1

The loop checks every word but the problem is that it does not wait for all the loop it stops after a few minutes.

How can I make it wait to finish all the words in the list?

This is my code:

<?php 

    $_keywords = $_POST['keys'];
    $_keywords = explode ( "\r\n", $_keywords );

    foreach($_keywords as $key=>$value){

        $k = explode("\t", $value);
        $_keywords[$key] = implode(" ", $k);

    }

    $maxy =  count($_keywords)-1 ;      

    echo 'search start';

    for ($iy = 0; $iy <= $maxy; $iy++) {

        $miss ="http://mysite/2.php?key=".$_keywords[$iy];
        echo $miss."<br>"  ;
        $page = file_get_contents($miss);

        echo $iy .' > '.$_keywords[$iy].' : '. $page ."<br>";

        usleep(200000);

    }
?>
Henders
  • 1,195
  • 1
  • 21
  • 27
max
  • 33
  • 2
  • 8
  • You might be hitting the [maximum execution time](http://stackoverflow.com/questions/8744107/increase-max-execution-time-in-php) although with no error message here, it's hard to say for definite. – Henders Aug 16 '16 at 16:21
  • 2
    `usleep(200000)`, really? – u_mulder Aug 16 '16 at 16:21
  • Uhm... your site is spamming another site to check words. Is the other site OK with you using it like this? – Machavity Aug 16 '16 at 16:23
  • what u mean i remove it and still not wait for finish – max Aug 16 '16 at 16:23
  • Machavity :P it my script in my siteweb . i spilit in two script .and still take along time :P – max Aug 16 '16 at 16:24

0 Answers0