Jump to content

PHP Command Line


The Little Guy

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/71491-php-command-line/
Share on other sites

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
}
?>

Link to comment
https://forums.phpfreaks.com/topic/71491-php-command-line/#findComment-360332
Share on other sites

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.