I use parallelcurl.php
(https://github.com/petewarden/ParallelCurl) library to send async requests to server. My code :
$urls = array('link1','link2'...'link100');
function on_request_done($content, $url, $ch, $search) {
$code = curl_getinfo($ch,CURLINFO_RESPONSE_CODE);
$size = curl_getinfo($ch,CURLINFO_SIZE_DOWNLOAD);
echo "Code : ".$code." Size : ".$size."<br>";
}
$max_requests = 1;
$parallel_curl = new ParallelCurl($max_requests);
foreach ($urls as $url) {
$parallel_curl->startRequest($url, 'on_request_done');
}
$parallel_curl->finishAllRequests();
I did some experiments with max_requests
parameters and faced to situations where max_requests=1
and max_requests=1001
needed same time interval to send requests and get response. I thought, that if max_requests
= 100, requests-response will more quickly, but I was wrong. May be I use this library not correct ? How can I send more requests use php
?
For Example - if I use jMeter I can send more than 4000 requests in min. is this possible in php
?
Aucun commentaire:
Enregistrer un commentaire