简体   繁体   中英

Best way to count successful curl fetches

I'm looking for the best way to count successful curl fetches, i sort of just pieced things together here, it works but its a bit slow, is there any faster alternative? I'm running/refreshing the script over one minute and trying to determine how many times everything is pulled successfully within that minute.

if(curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
$counter = @file_get_contents('count.txt');
$counter++;
@file_put_contents('count.txt', $counter);
}

为了加快速度,您可以使用多线程curl: http : //www.php.net/manual/en/function.curl-multi-info-read.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM