Results 1 to 5 of 5

Thread: GoTo() & Reload()

  1. #1
    Join Date
    Nov 2006
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default GoTo() & Reload()

    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.

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    PHP Code:
    <?php
    $location 
    'mypage.html';
    $seconds 10;
    echo 
    '<html><head><meta http-equiv="refresh" content="'.$seconds.';url='.$location.'" /></head><body></body><html>';
    ?>
    Untested.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    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.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  4. #4
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Probably. But if you design the page(s) in a certain way, then the script would be useful.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •