Well it looks like I have a new problem!
I've written some PHP code which reads a text file containing some URLs into an array. Some Javascript is then called upon to open a new browser window and display the URLs in this window, in succession. The idea is that I can do this with a delay - i.e. each URL will display for something like say 30 seconds and then open the new one. Here's my code:
Code: Select all
<?php
$urls_array = file('process.txt');
$last_displayed_url = $_GET['lurl'];
$new_url = $urls_array[(array_search($last_displayed_url, $urls_array)+1)];
foreach ($urls_array as $url) {
$url = trim($url);
echo "<script language=Javascript>";
echo "window.open('$url','test');";
echo "</script>";
}
?>Code: Select all
...rest of code...
foreach ($urls_array as $url) {
$url = trim($url);
echo "<script language=Javascript>";
echo "window.open('$url','test');";
echo "</script>";
sleep(30); //Added a sleep command to the loop here
}Does anyone know why this may be or if there is a better way to introduce a delay in a loop like this? Everything works else works fine except for this one little thing.
- Gordon