0

Hi I want to get all titles from one web page source. So I try to use php xpath and I write:

$dom = new DOMDocument();
@$dom->loadHTMLFile('http://some-site.com/egypt/book-shops');
$xpath = new DOMXPath($dom);
$entries = $xpath->query("//td[@class='icon']/i/@title");
foreach($entries as $e) {
  echo 'Title is : ' . $e->textContent . '<br />';
}

the web source code is:

<td class="icons">
            <i title="info@some-site.de" data-shopnameid="Good Life" class="icon email-small message-shop" id="message-shop-8"></i>
                                                                                                            ... ... ...

Where I wrong, what is error. I just get white screen.

Andrew
  • 2,128
  • 3
  • 24
  • 42
  • see as well: [Reference - What does this error mean in PHP?](http://stackoverflow.com/q/12769982/367456) – hakre Oct 12 '14 at 12:10

1 Answers1

1

The class isn't icon, it's icons:

$entries = $xpath->query("//td[@class='icons']/i/@title");
nickb
  • 59,313
  • 13
  • 108
  • 143