In test.html
,demo
word included only。
demo
curl.php
<php?
//init curl
$chArr=[];
for($i=0;$i<500;$i++){
$chArr[$i]=curl_init("http://dev.site/test.html");
curl_setopt($chArr[$i],CURLOPT_RETURNTRANSFER,1);
}
//create curl
$mh = curl_multi_init();
foreach($chArr as $k => $ch){
curl_multi_add_handle($mh,$ch);
}
$running = null;
do{
curl_multi_exec($mh,$running);
}while($running > 0);
//start multi-thread
foreach($chArr as $k => $ch){
$result[$k]= curl_multi_getcontent($ch);
//and echo out the result
echo "$result[$k]\n"
curl_multi_remove_handle($mh,$ch);
}
curl_multi_close($mh);
I've set 500 requests,about 10s later got the output and there is no response during processing
Is there anyway to display the result and give me a Feedback since every single curl request is done,just like below?
PS:if PHP is hard to do this so,I could accept Nodejs,Python etc.