如何延迟5秒然后使用file_get_contents PHP?

How to delay for 5 sec and then use file_get_contents PHP ?

I use this code for get text from webpage using url.

index.php

<?PHP
$text = file_get_contents('https://www.othersite.com/test_1.php');
echo strip_tags($text); // If you only need text not html structure
?>

.

.

https://www.othersite.com/test_1.php

<meta http-equiv="refresh" content="5;url=https://www.othersite.com/test_2.php">

https://www.othersite.com/test_2.php

HELLO WORLD.

When i load mysite (index.php). how to delay for 5 sec then use file_get_contents and it's will show result HELLO WORLD.

use :

sleep(5); // seconds

function

You can use the PHP function sleep

Example:

<?PHP
sleep(5); //Sleeps for 5 sec
$text = file_get_contents('https://www.othersite.com/test_1.php');
echo strip_tags($text); // If you only need text not html structure
?>