1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP redirect with time delay

Discussion in 'PHP' started by Luke Jones, Jul 27, 2007.

  1. #1
    Hello,
    Is there a php redirect with a time delay similar to the Javascript redirect?
    Does anyone know how to do this?

    Thanks.
     
    Luke Jones, Jul 27, 2007 IP
  2. Luke Jones

    Luke Jones Peon

    Messages:
    427
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Ok, I think I've found it:
    header('Refresh: 3; url=index.html');
    please correct me if I'm wrong.
     
    Luke Jones, Jul 27, 2007 IP
  3. Luke Jones

    Luke Jones Peon

    Messages:
    427
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Can anyone explain why this is not working:

    $url = ($_GET['url']);
    $new_url = rawurldecode(rawurldecode(end(explode('*', $url))));
    header('Refresh: 10; url=http://linkanon.com/?r=$new_url');

    I want it to take the url from the browser, and put it in the $new_url position above.
     
    Luke Jones, Jul 27, 2007 IP
  4. Jezek

    Jezek Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you cannot have a time delay with php header. use a meta refresh.
     
    Jezek, Jul 27, 2007 IP
  5. Luke Jones

    Luke Jones Peon

    Messages:
    427
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Luke Jones, Jul 27, 2007 IP
  6. smallbizstartupkit

    smallbizstartupkit Well-Known Member

    Messages:
    163
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #6
    What version of PHP are you using?
     
    smallbizstartupkit, Jul 27, 2007 IP
  7. Luke Jones

    Luke Jones Peon

    Messages:
    427
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I think it's 4.0.
     
    Luke Jones, Jul 28, 2007 IP
  8. PowerExtreme

    PowerExtreme Banned

    Messages:
    2,118
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    0
    #8
    y u wanna do that . y not just use meta redirect instead
     
    PowerExtreme, Jul 28, 2007 IP
  9. tamilsoft

    tamilsoft Banned

    Messages:
    1,155
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Hi,

    Try this

    <?php
    sleep(10);//seconds to wait..
    header("Location:http://www.domain.com");
    ?>
    PHP:
     
    tamilsoft, Jul 28, 2007 IP
  10. baddot

    baddot Active Member

    Messages:
    309
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #10
    or you can go into sleep() mode
     
    baddot, Jul 28, 2007 IP
  11. Luke Jones

    Luke Jones Peon

    Messages:
    427
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Thanks for your responses.
    What is best for allowing my script to be read by a spider, but immediately redirected for visitors? Or is a Javascript redirect better for this?

    Thanks.
     
    Luke Jones, Jul 28, 2007 IP
  12. daveq1122

    daveq1122 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Jezek is right, you can't time delay functions in PHP,but tamilsoft's suggestion (using wait()) is a great idea. More information here:

    http://php.net/manual/en/function.sleep.php

    http://php.net/manual/en/function.header.php

    http://www.phpredirection.com/

    Luke Jones: The best option would be to do it with JS since the Google robot doesn't have JS. The JS will only run when human visitors will visit your site. There's only the off user that doesn't have nowadays. This tutorial is useful:

    http://www.tizag.com/javascriptT/javascriptredirect.php
     
    daveq1122, Jan 16, 2012 IP