Web crawler-PHP Analog network request

Source: Internet
Author: User
For example, I ask Baidu, I want to know that this time a total request for those resources, including pictures, js,css, but do not want to file_get_content later take these and then use regular analysis, there is a better way?

Reply content:

For example, I ask Baidu, I want to know that this time a total request for those resources, including pictures, js,css, but do not want to file_get_content later take these and then use regular analysis, there is a better way?

There is no such method. Maybe you can find a well-packaged object to complete your needs, but the inside of this object must also be counted by parsing the string.

In fact, thinking about it, your intentions are not logical in themselves. What about the browser, not the first to get the HTML source code, and then go through the line, so that one by one request CSS, JS, image and other resources? This is the logic that conforms to the law of things, it is like asking you how many layers of a building, the only way is to count, perhaps some instruments can be calculated, but the principle of the instrument is also a layer of the number.

The program is built on the basis of logic, the development of the function can be done without others to build the wheel, but does not mean that you can erase the wheel of the logic represented.

Either way, do a little bit of work.

Recommended use of Simplehtmldom

  • Related Article

    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.