<?php <?php set_time_limit(0); $urls = array('http://www.baidu.com','http://www.php.cn',); $handle = curl_multi_init(); $curls = array(); foreach ($urls as $k=>$url) { $curls[$k] = add_handle($handle, $url); } function add_handle(& $handle, $url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, ''); curl_setopt($curl,CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_multi_add_handle($handle, $curl); return $curl; }
这是一个php的curl多线程采集类,需要的朋友可以下载使用。
本站所有资源均由网友贡献或各大下载网站转载。请自行检查软件的完整性!本站所有资源仅供学习参考。请不要将它们用于商业目的。否则,一切后果由您负责!如有侵权,请联系我们删除。联系方式:admin@php.cn
相关文章
![为什么我的 JNI 项目找不到依赖库?](https://img.php.cn/upload/article/001/246/273/173213569482091.jpg)
21Nov2024
解决 UnsatisfiedLinkError: Can't Find Dependent Libraries in JNI Projects当开发 Java Native Interface (JNI) 项目时,您可能...
![phpmyadmin不显示登录页面](https://img.php.cn/upload/article/000/000/039/5db90ac1ae7a5772.jpg)
30Oct2019
phpmyadmin不显示登录页面解决方法:找到并打开phpMyAdmin\libraries\plugins\auth\AuthenticationCookie.class.php文件,将其中关于登录页面代码中的两处hide删除即可。
![如何修复 phpMyAdmin 中的'count():参数必须是实现可数的数组或对象”错误?](https://img.php.cn/upload/article/001/246/273/172940007066319.jpg)
20Oct2024
phpMyAdmin 错误:“count():参数必须是实现可数的数组或对象”您是否遇到过 phpMyAdmin 错误,指出“./libraries/sql.lib.php#601\ncount() 中的警告:参数必须是数组或对象
![dacom.dll - 什么是 dacom.dll?](https://img.php.cn/upload/article/001/246/273/172930101134831.png)
19Oct2024
dacom.dll 在我的计算机上做什么? dacom.dll 是 Microsoft Corporation 创建的 Digital Anvil Component Libraries 使用的 DLL 文件。此过程仍在审核中。 dacom.dll 等非系统进程源自您安装的软件
![如何使用 CSS 网格布局创建砌体网格,其中每个元素具有相同的宽度,但底部元素始终低于顶部元素 50px?](https://img.php.cn/upload/article/001/246/273/173181450333691.jpg)
17Nov2024
Create a Masonry Grid with CSS Grid Layout (or Other CSS)该问题询问一种在 CSS 中实现砖石网格效果的方法...
![ctvcal.dll - 什么是 ctvcal.dll?](https://img.php.cn/upload/article/001/246/273/172904667043708.png)
16Oct2024
ctvcal.dll 在我的计算机上做什么? ctvcal.dll 是属于 Oracle Corporation 的 Oracle Calendar Libraries 的一个模块。 ctvcal.dll 等非系统进程源自您系统上安装的软件。由于大多数应用程序
![](/static/imghwm/down_right.png)
![](/static/imghwm/taglogo.png)
Hot Tools
![](/static/imghwm/taglogo.png)