Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to parse HTML with PHP?
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/3577641/how-to-parse-and-process-html-with-php">How to parse and process HTML with PHP?</a> </p> </blockquote> <blockquote> <p><strong>Suggestion for a reference question</strong>. Stack Overflow has dozens of "How to parse HTML" questions coming in every day. However, it is very difficult to close as a duplicate because most questions deal with the specific scenario presented by the asker. This question is an attempt to build a generic "reference question" that covers all aspects of the issue. </p> <p>This is an experiment. If such a reference question already exists, let me know and I'll happily remove this one.</p> <p>My ideal vision is that each of the three questions gets answered separately, and the best answers to each bubble up to the top.</p> <p>I will be awarding a <strong>200 bounty</strong> to the best answer in each of the three categories two weeks from now, <strong>pending <a href="https://meta.stackexchange.com/questions/63762/do-reference-questions-make-sense">discussion of this question</a> on Meta</strong>. </p> <p>Each of these questions have already been answered brilliantly elsewhere, so copy+pasting your own answer to a different question is fine with me. </p> </blockquote> <p><strong>How do I parse HTML with PHP?</strong></p> <ol> <li><p>What libraries are there? Which ones use PHP's native DOM, which ones come with their own parsing engine? (Hint: SimpleHTMLDOM)</p> <p>1a. I need to find a specific element, but I find it hard to get used to the XPath syntax. Are there any DOM-based libraries that make parsing HTML easier? Please consider making generic real world examples. </p></li> <li><p>Is there a PHP library that enables me to query the DOM using CSS[2/3] selectors, like jQuery does? (Hint: phpQuery) Please consider making generic real world examples. </p></li> <li><p>Bonus question: Why shouldn't I use regular expressions? Please provide a very short answer in layman's terms.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload