The Little Guy Posted October 2, 2007 Share Posted October 2, 2007 I am running PHP from the command line, so I can have a huge loop, so... how can get the file to start over once it gets to the end of an array? after the foreach, I was thinking of having: <?php header("Location: contentRobot.php"); exit; ?> But... I'm not sure if that is only valid for browser or not. Quote Link to comment https://forums.phpfreaks.com/topic/71491-php-command-line/ Share on other sites More sharing options...
trq Posted October 2, 2007 Share Posted October 2, 2007 Headers are http specific, so no, a call to the header() function is useless. Explain (or show) exactly what it is your trying to do. You could simply include the file again, or execute it via exec, but i suspect your logic may be whack. Quote Link to comment https://forums.phpfreaks.com/topic/71491-php-command-line/#findComment-359923 Share on other sites More sharing options...
The Little Guy Posted October 2, 2007 Author Share Posted October 2, 2007 OK... This is off the top of my head (shorthand): <?php set_time_limit(1200); $sql = mysqli_query($db,"SELECT URL,content from webSearch WHERE content = ''"); while($row = mysqli_fetch_array($sql){ //Go to the url, get the page title, and remove all the tags //Save the title and content to the database or update the old url } // all the blank content fields have been filled // Check if any new URL's have been added $sql = mysqli_query($db,"SELECT URL,content from webSearch WHERE content = ''"); if(mysqli_num_rows($sql)>0){ // restart because there are some new URL's set_time_limit(1200); }else{ exit; // End the program } ?> Quote Link to comment https://forums.phpfreaks.com/topic/71491-php-command-line/#findComment-360332 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.