Hi @awecodebox, thanks for reaching out.
Rate Limiting with requests from the site’s own server back to itself, or within a development environment won’t have the desired effect as private IPs aren’t rate limited. I would use cURL or a browser from another machine.
Thanks,
Peter.
I wrote the following function to make 500 requests from another server to my website that location on a different server
function sendMultipleRequests($url, $numRequests = 500) {
$mh = curl_multi_init();
$handles = [];
for ($i = 0; $i < $numRequests; $i++) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// You can set other CURL options as needed
curl_multi_add_handle($mh, $ch);
$handles[] = $ch;
}
$running = null;
do {
curl_multi_exec($mh, $running);
} while ($running > 0);
$responses = [];
foreach ($handles as $ch) {
$responses[] = curl_multi_getcontent($ch);
curl_multi_remove_handle($mh, $ch);
}
curl_multi_close($mh);
var_dump( $responses );
}
// Example usage
$url = 'https://example.com/wp-json/contact-form-7/v1';
$responses = sendMultipleRequests($url);
But as you can see in the following screenshot
https://prnt.sc/1ZP8R4XQzJEs
https://prnt.sc/sLqEm-spHxOF
Can you tell me where my mistake is in this test?
Or might it doesn’t work. I’m confusing