How to Allow Downloading in 3 Seconds With PHP

x theme

Following is a script that will allow downloading in 3 seconds with PHP. The script will take a parameter, let’s say, “value=download“.

We’ll use header for refreshing after 3 seconds. If the value of the parameter will be “download“, it will echo the message “Downloading” else it will start download in 3 seconds.

In the script, we just have used “echo” to display message. But you can put extra stuff.

// if name via get equals 'download", show the downloading message.
if($_GET['value'] == "download"){

echo "Downloading ... ";

} else {
// set refresh to 3 seconds, make the variable name be 'download' via the get method;
header("Refresh: 3: url=http://example.com?value=download");
// show this message
echo "You can download in 3 seconds.";

}

Related posts:

About the author

admin

Leave a Reply

Your email address will not be published. Required fields are marked *