Overview
Crawler is a function that we often encounter when making programs. PHP has many open source crawler tools, such as snoopy. These open source crawler tools can usually help us complete most of the functions, but in some cases, we need to implement a crawler ourselves. This article explains how to implement crawlers in PHP a summary.
Main methods of implementing crawler in PHP
1.file() function
2.file_get_contents() function
3.fopen()->fread()->fclose() method
4.curl method
5.fsockopen() function, socket mode
6. Use open source tools, such as: snoopy
Main ways for PHP to parse XML or HTML
1. Regular expression
2.PHP DOMDocument object
3. Plug-ins, such as: PHP Simple HTML DOM Parser
Summary
Here is a brief summary of the way PHP implements crawlers. There is a lot more content in this article. Later, we will make a summary of the way PHP parses HTML and XML.