Yes, you would just do:
$name = $html->find('a[itemprop=name]', 0)->text();
This isn't xpath btw, it's css.
Domanda
I'm using simple html dom parser and i'm trying to get the company name from the following string:
<a data-omniture="LIST:COMPANYNAME" href="/b/Elite+Heating+and+Plumbing+Services-Plumbers-Reading-RG46RA-901196207/index.html" itemprop="name"> Elite Heating & Plumbing Services </a>
So the bit in between the a tags.
I have the following code:
<?php include_once('simple_html_dom.php');
$html = file_get_html('http://www.thelink.com/');
foreach($html->find('a') as $element)
echo $element->href . '<br>'; echo '</ul>';
?
Also, is it posible to search for html5 data things, so data-whatever: the info in the link
Which brings all the links back, but obviously i don't want all the links.
Soluzione
Yes, you would just do:
$name = $html->find('a[itemprop=name]', 0)->text();
This isn't xpath btw, it's css.