Creating PHP parsers

I would like to know what topics you need to know to create parsers in PHP.


Answer 1, authority 100%

Well, for simple parsers, it’s enough to know what a for loop is and
working with regular expressions (functions preg_match, preg_match_all).


Answer 2, authority 100%

Knowledge of PHP parsers is required.
Well, either knowledge of regular expressions or simple logic (for character-by-character enumeration).
Are you talking about parsers of what?


Answer 3, authority 33%

  1. First, you need to know HTML and DOM. Searching for information in the received HTML page code is not possible without this.
  2. Secondly, it is sometimes difficult to do without knowledge of regular expressions.
    Of course, you must have sufficient knowledge of PHP.

Then, when you start writing parsers, it turns out that curl is needed. And multithreading is useful for speeding up work


Answer 4

  • pcntl_fork – run in multi-threaded mode
  • curl – getting pages, faster than file_get_contents and you can set request headers yourself to look more like a real user
  • html page parser like nokogiri and regular expressions to get the right data