Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.