This PHP script provides an API endpoint that accepts a GET parameter time representing the number of seconds to sleep. It also implements rate limiting based on the sender's IP address, allowing only one request per 5 seconds, and enforces a maximum time execution limit of 600 seconds (10 minutes).
Endpoint: http://dev.pait.pl/timeout-test/timeout-test.php
time (required): Number of seconds to sleep before the script completes execution.URL: http://dev.pait.pl/timeout-test/timeout-test.php?time=5
Description: Sleeps for 5 seconds and returns a success message.
URL: http://dev.pait.pl/timeout-test/timeout-test.php?time=10
Description: Attempts to sleep for 10 seconds, but the rate limit of 1 request per 5 seconds is exceeded, so an error message indicating rate limit exceeded is returned.
URL: http://dev.pait.pl/timeout-test/timeout-test.php?time=700
Description: Attempts to sleep for 700 seconds, exceeding the maximum time execution limit of 600 seconds. Therefore, an error message indicating maximum time limit exceeded is returned.
The API returns responses in JSON format with the following structure:
{
"status": "success" | "error",
"message": "Script executed after X seconds." | "Invalid time value provided." | "Rate limit exceeded for this IP address." | "Maximum time limit exceeded."
}