View Full Version : GoTo() & Reload()
GhettoT
03-17-2007, 04:58 AM
I realize there are no "GoTo()" and "Reload()" functions in PHP but let me explain what I am trying to get at... I am trying to write a PHP script that I can tell it, go to a certain URL (page), then wait x amount of seconds/minutes, then reload the page and repeat this process to a previously indicated amount of times. Now, I already know I cannot use th sleep() function because most servers have a limit of how long a script can execute for. I want to use this script for debugging another PHP project I made. I want to try and break it (funny enough) by having it get "hit" by the same ip multiple times in a certain amount of time. Now, does anyone have any ideas how to do this without using AJAX of Javascript? I would really like a pure PHP script if at all possible. Once I am done with testing, I will take down the page, as it is EXTREMELY inconsiderate towards the servers/hosts, but I figure for a half hour-an hour of testing, its OK. Thanks in advance.
tech_support
03-18-2007, 03:25 AM
<?php
$location = 'mypage.html';
$seconds = 10;
echo '<html><head><meta http-equiv="refresh" content="'.$seconds.';url='.$location.'" /></head><body></body><html>';
?>
Untested.
thetestingsite
03-18-2007, 03:28 AM
That would just redirect the user to the "mypage.html" once and that's it. What the OP was asking for was to use it mulitple times at certain intervals. The only thing that I could suggest is have a meta redirect (or php header) redirect to the same page mulitple times in however many seconds you wish.
Hope this helps.
tech_support
03-18-2007, 03:39 AM
Probably. But if you design the page(s) in a certain way, then the script would be useful.
djr33
03-18-2007, 03:56 AM
You need javascript for this. You can have any repeated reloading or interaction from just PHP. If needed, AJAX (a method of javascript) can call PHP scripts and get their results, but I don't think/know if this would be required in this case.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.