Web Crawler-PHP simulates network requests

Source: Internet
Author: User
For example, if I request Baidu, I want to know the resources I have requested in total, including images, JS, and CSS, but I don't want FILE_GET_CONTENT to use this and then use regular expression analysis, is there a better way? For example, if I request Baidu, I want to know the resources I have requested in total, including images, JS, and CSS, but I don't want FILE_GET_CONTENT to use this and then use regular expression analysis, is there a better way?

Reply content:

For example, if I request Baidu, I want to know the resources I have requested in total, including images, JS, and CSS, but I don't want FILE_GET_CONTENT to use this and then use regular expression analysis, is there a better way?

This method is not available. Maybe you can find an encapsulated object to meet your needs, but the object must be analyzed internally for statistics.

As a matter of fact, you will know that your intention is not logical. What about the browser? Isn't it the first step to get the html source code and then execute the code line by line to request resources such as css, js, and image? This is the logic that conforms to the laws of things. It is like asking you how many floors are there in a building. The only way is to count them. Maybe some instruments can calculate them, however, the working principle of the instrument is also a layer-by-layer number.

The program is based on logic. When developing functions, you don't need the wheel built by others, but it doesn't mean that you can erase the logic represented by that wheel.

Either way, you have to do some work.

We recommend that you use simplehtmldom.

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.