Untitled

mail@pastecode.io avatar
unknown
plain_text
20 days ago
556 B
2
Indexable
Never
<?php
$timeoutFile = 'timeout.txt';
if(!file_exists($timeoutFile)) {
    file_put_contents($timeoutFile, time());
}

$startTime = file_get_contents($timeoutFile);
$currentTime = time();
$elapsedTime = $currentTime - $startTime;

if($elapsedTime < 900) {
    $ch = curl_init($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_exec($ch);
    curl_close($ch);
} else {
    if($elapsedTime > 900 && $elapsedTime < 910) {
        file_put_contents($timeoutFile, time());
    }
}
?>
Leave a Comment