Author Topic: PHP Simple HTML DOM  (Read 1650 times)

0 Members and 1 Guest are viewing this topic.

Offline JoeLongstreetTopic starter

  • Irregular
  • Posts: 17
    • View Profile
PHP Simple HTML DOM
« on: January 09, 2010, 01:34:03 PM »
I'm using the "PHP Simple HTML DOM Parser" - http://simplehtmldom.sourceforge.net/manual.htm

I'm running through a bunch of elements and I need to determine what kind of element it is that I'm returning.

For example

Code: [Select]
<html>
<div id='wrap'>
<h1>Heading</h1>
<p>something</p>
<p>something</p>
<h2>Second Heading</h2>
</div>
</html>

//PHP
$html = 'http://somehtmldoc.html'
foreach($html->find('div[id=wrap]') as $thing) {
$var = $thing->this should tell me if it's an h4, p, h1, etc.
}

Any help is much appreciated.

Thanks,

Joe
« Last Edit: January 09, 2010, 01:35:06 PM by JoeLongstreet »

Offline drumstok

  • Irregular
  • Posts: 1
    • View Profile
Re: PHP Simple HTML DOM
« Reply #1 on: February 01, 2010, 08:04:44 AM »
http://simplehtmldom.sourceforge.net/manual_api.htm

Just access the "tag" property: $element->tag