1,105,581 Community Members

Echo HTML tags using PHP DOM parser

Member Avatar
cursedever
Newbie Poster
1 post since Nov 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello everyone!
I've been using this simple html parser here: http://simplehtmldom.sourceforge.net/, yes, its working like selecting all the divs with specified id's,but my question is, how about if i'm gonna include to show and select the tags like: <head> </head>, <div> </div>.

Any idea how to do this?

Thanks :)

Member Avatar
hielo
Veteran Poster
1,131 posts since Dec 2007
Reputation Points: 55 [?]
Q&As Helped to Solve: 246 [?]
Skill Endorsements: 0 [?]
 
0
 

Look the source code of the page you are interested in. Let's say that the DIV you are interested in is the THIRD in the page's HTML source code (but it has no attributes - id, class, etc).

Since you know it is the third, then you can get it by issuing find('div', 2) . The first DIV would be on index zero; the second in index one, etc.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: