vendredi 24 juin 2016

Go to URLs in batch with time interval PHP MySQL


I am new to PHP and MySQL. I don't know if this is possible

Here is my MySQL table

    Id   url
    1    http://www.urla.com
    2    http://www.urlb.com
    3    http://www.urlc.com
    4    http://www.urld.com
    5    http://www.urle.com
    6    http://www.urlf.com
    7    http://www.urlg.com
    8    http://www.urlh.com
    9    http://www.urli.com
    10   http://www.urlj.com

Here is my php code

$getURL_List="select url from my_table";
$statement = $mysqli->prepare($getURL_List);

   //execute query
   $statement->execute();

   //store result
   $statement->store_result();

   //bind results variables
   $statement->bind_result($url);

   //count the result
   $countRows = $statement->num_rows;

   while ($statement->fetch()) {

   Questions: 
  ============ 
 How do I get the first 5 url returned from my query and open them in the browser

1    http://www.urla.com - go to this URL (open it in the browser)
2    http://www.urlb.com - go to this URL (open it in the browser)
3    http://www.urlc.com - go to this URL (open it in the browser)
4    http://www.urld.com - go to this URL (open it in the browser)
5    http://www.urle.com - go to this URL (open it in the browser)

So, 5 browser windows will be opened

then, wait for 5 seconds then get the next 3 urls

6    http://www.urlf.com - go to this URL (open it in the browser)
7    http://www.urlg.com - go to this URL (open it in the browser)
8    http://www.urlh.com - go to this URL (open it in the browser)

So, 3 browser windows will be opened

and repeating the above step of getting 3 urls until no more url is left to go through.Then the operation is ended.

   }
$statement->close();
?>

Please help guide me to the right direction so that I could solve this problem. Any input or guidance you could provide will be greatly appreciated. Thank you.


Aucun commentaire:

Enregistrer un commentaire