您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP CURL 多线程 GET/POST 类

2025/1/2 9:22:19发布16次查看
$url) { $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_timeout, 30); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_postfields, $post[$key]); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_nosignal, true); curl_multi_add_handle($queue, $ch); $map[(string) $ch] = $url; } $responses = array(); do { while (($code = curl_multi_exec($queue, $active)) == curlm_call_multi_perform) ; if ($code != curlm_ok) { break; } while ($done = curl_multi_info_read($queue)) { $error = curl_error($done['handle']); $results = curl_multi_getcontent($done['handle']); $responses[$map[(string) $done['handle']]] = compact('error', 'results'); curl_multi_remove_handle($queue, $done['handle']); curl_close($done['handle']); } if ($active > 0) { curl_multi_select($queue, 0.5); } } while ($active); curl_multi_close($queue); return $responses;}
复制代码
多线程, php, curl
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product