1

I am useing Zend\Dom\Query to get specific content from a webpage.

This is the html:

<div class="menuName darkGreen leftMenu">
   <a href="index.php?ref=MjBfMDJfMDZfMTRfMV8x">Mouse</a>
</div>

How can I get the value Mouse ??

Thanks

Foysal Vai
  • 1,365
  • 3
  • 13
  • 19

2 Answers2

2

Try this:

$dom = new \Zend\Dom\Query($html);
$results = $dom->execute('div.menuName a');
$doc = $results->current();
var_dump($doc->nodeValue);
Bram Gerritsen
  • 7,178
  • 4
  • 35
  • 45
  • Thanks for reply. It is working. I would like to know more about this `current()` function. I need the documentation. I have another problem like below
    ``
    I would like to catch img src attribute.
    Thanks
    – Foysal Vai Feb 07 '14 at 13:29
1

Try this:

$doc->getAttribute('src');
krasen
  • 11
  • 1