PHP - 获取html页面结构

I am looking for a way to get HTML page structure using PHP.

What I want to achieve is to be able to check whether the page structure was changed (NOT the content).

For example, I want to be able to know when a new feature was added (or removed) from a page with often changing content. If a feature was added or removed the structure gets changed also.

What is a good way to do that? Using DOMDocument, Xpath or any other method you can think of?

I have tried to use DOMDocument but is it a very difficult task...

Thoughts?

I suggest use selenium/jquery and xpath to count no of element in div or body-html and check if number changed or not.

The easiest method that i can think of is using file_get_contents() of the document and store it in a database then have a cron that checks daily or whichever interval works for you and re-retreive the contents again and check against the data stored in the database to see if they match.