views:

22

answers:

1

$content = file_get_contents(http://www.domain.com/page.html);

$dom = new DOMDocument();
if (!@$dom->loadHTML($content)) die ("Couldn't load file?");

$title = $dom->getElementById("cssid"); 
$data['heading'] = $title->nodeValue; // this works fine

I would like to be able to select all p tags that are within a certain id. With Jquery Ii would do something like $('#mycssid p');

How would I do this using the DOMDocument class

+2  A: 
$x = new DOMXPath($dom);
$nodelist = $x->query("//*[@id='cssid']//p");
Wrikken