PHP code example of mars-php-util / rate-limit-bypass
1. Go to this page and download the library: Download mars-php-util/rate-limit-bypass library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mars-php-util / rate-limit-bypass example snippets
use RateLimitBypass\ApiKeyRateLimitHelper;
$max_request_per_second = 10;
$api_keys = [...];
$rotator = new ApiKeyRateLimitHelper($api_keys, $max_request_per_second);
function getUser($id) {
$api_key = $rotator->tap(); // api key can be in query string, headers, path, ... depend on the API endpoint
$curl = curl("https://example-api.com/user/$id?apiKey=$api_key");
curl_setopt_array($curl, $your_options);
$response = curl_exec($curl);
return $response;
}
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.