For most websites, your first requests will always be successful, however, it’s inevitable that some of them will fail. For these failed requests, the API will return a 500 status code and won’t charge you for the request. In this case, we can make our code retry to make the requests until we reach a maximum number of retries that we set: <?php // Get cURL resource $ch = curl_init(); // Set base url & API key $BASE_URL = "https://app.scrapingbee.com/api/v1/?"; $API_KEY = "YOUR-API-KEY"; /...