Pthreads multi-thread data collection. In the past, multithreading with curl was not a real multithreading, but a simulated multithreading. now pthreads is used to implement real multithreading. Download: in windows: http: The multithreading that used curl in the past is not a real multithreading, but a simulated multithreading. now pthreads is used to implement real multithreading.
Download:
Windows:
Http://windows.php.net/downloads/pecl/releases/pthreads/0.0.45/
For mac, unix, and linux:
Https://github.com/krakjoe/pthreads
Windows:
Decompress the pthreadvc2.dlland php_pthreads.dllfiles, put the vc2file to the same directory of php.exe, and put php_pthreads.dll to the extension directory.
Modify the php. ini file and add extension = php_pthreads.dll.
Modify the Apache configuration file httpd. conf and add LoadFile "yourpath/php/pthreadVC2.dll"
For mac, unix, and linux:
For details, refer to the banquet brother blog http://blog.s135.com/pthreads/
Call method:
Specific usage can also refer to the banquet brother blog http://blog.s135.com/pthreads/
Combined with the previous get_html, the class can also be implemented in this way.
threads = '' = __construct(, = ->url = ->options = (!(-> ->data = ->get_html(->url, -> get_html(, = (( [CURLOPT_RETURNTRANSFER] = [CURLOPT_TIMEOUT] = 5 = curl_init( curl_setopt_array(, = curl_exec( curl_close( ( === }
Bytes. Download: windows: http :...