hello, Anybody i can help me to edit this php script in multi thread ! Please i very need. <?php $imput = file("$argv[1]"); $output = $argv[2]; foreach ($imput as $nr => $line) { $line = trim($line); print ("$nr - check :" . $line . "\r\n"); $check = ia_continutul($line); if (strpos($check,'wordpress') !== false) { $SaveFile = fopen($output, "a"); fwrite($SaveFile, "$line\r\n"); fclose($SaveFile); } } print "The END !\r\n"; function ia_continutul($url) { $ch = curl_init(); $timeout = 3; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); curl_setopt($ch, CURLOPT_TIMEOUT, 5); $data = curl_exec($ch); curl_close($ch); return $data; } ?> PHP:
You should check out supervisord on linux. This allows you to run multiple processes at same time and restart one if it stopped. Hope it helps.