How to Auto Refresh webpage every 5 seconds in PHP?

Published on July 7, 2013 by abundantcode

Filed under PHP

Last modified July 7, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 4.5 (2 votes)

This article have been viewed 11011 times

Below is a sample code demonstrating how to refresh the webpage automatically every 5 seconds in PHP.

How to Auto Refresh webpage every 5 seconds in PHP?

<?php

$url1=$_SERVER['REQUEST_URI'];

header("Refresh: 5; URL=$url1");

?>
0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

4 Comments

  1. longdy

    i have problem FormValidator last click oclin button update but me click on button save update a gan it not validate

    December 25, 2014 - 8:45 am – Reply

  2. Adam

    Hi i think i can use this for a problem i have….
    I need to find a way to get a page refresh IF a string is empty..
    LOGIC BELOW.
    IF $mystring = “” THEN ?

    How can i rewrite your code?

    Thanks for your time

    March 27, 2016 - 9:51 am – Reply

  3. Wasef Dhiman

    if($mystring==””){
    $url1=$_SERVER[‘REQUEST_URI’];
    header(“Refresh: 5; URL=$url1”);
    }

    Try this bro. 🙂

    July 4, 2016 - 3:37 am – Reply

    • Kumar

      Sure 🙂

      July 5, 2016 - 7:38 pm – Reply

Leave a Comment


x

You might be Interested in these Posts

How to Download Web Content synchronously in C# ?

If you need to download the web content synchronously using C# , you can use the WebClient class tha...

PHP Code Refactoring Tools

Here's a list of some of the Refactoring tools for the PHP developers.PHP Code Refactoring Tools...

Best and Free PHP based eCommerce CMS (Content Management System)

There are plenty of PHP based eCommerce CMS solutions that are available and in this article, we lis...