Help me. Parsing html documents with php
Hello,
I need to parse html documents to get "values" of all html tags and their attributes like if I have:
<a href="url_here" title="title_here"> text_here </a>
Then I need 3 values of:
array(
'href' => 'url_here',
'title' => 'title_here',
'tag_value' => 'text_here'
);
How to do this?
Please let me know. If possible please give me some code.
regards
Re: Help me. Parsing html documents with php
You could use the DOM Extension to load the HTML document into a DOM tree and then traverse that through code.
Re: Help me. Parsing html documents with php
Are you looking to do this for all tags or just selective tags as listed above?