Javascript-how to use CasperJs to capture webpages?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.