The idea of a php crawler is as follows: pcntl_fork or swoole_process achieves multi-process concurrency. It takes 500 ms to capture each web page, and 200 processes can be opened to capture 400 pages per second. Curl implements page capture and cookie setting to simulate... the idea of a php crawler is as follows:
-
Pcntl_fork or swoole_process implement multi-process concurrency. It takes 500 ms to capture each web page, and 200 processes can be opened to capture 400 pages per second.
-
Curl can capture pages and set cookies to simulate login to simple_html_dom for page parsing and DOM processing.
-
To simulate a browser, use casperJS. Encapsulate a service interface with swoole extension to call the PHP Layer
-
Here, a crawler system is implemented based on the above technical solutions. It captures tens of millions of pages every day.
It can be done at and. Of course I don't need swoole. CasperJS in point 3rd is not quite familiar. How can this problem be used?
Reply content:
The idea of a php crawler is as follows:
-
Pcntl_fork or swoole_process implement multi-process concurrency. It takes 500 ms to capture each web page, and 200 processes can be opened to capture 400 pages per second.
-
Curl can capture pages and set cookies to simulate login to simple_html_dom for page parsing and DOM processing.
-
To simulate a browser, use casperJS. Encapsulate a service interface with swoole extension to call the PHP Layer
-
Here, a crawler system is implemented based on the above technical solutions. It captures tens of millions of pages every day.
It can be done at and. Of course I don't need swoole. CasperJS in point 3rd is not quite familiar. How can this problem be used?
You can read its documentation. Here is an example of http://docs.casperjs.org/en/latest/quickstart.html
To put it simply, casperjs is a script based on phantomjs. Simulating a browser means that it does not need a browser to render the page, but it can also navigate and perform operations on the DOM.