<?php
//a URL you want to retrieve
$my_url = 'http://www.digg.com';
$html = file_get_contents($my_url);
$dom = new DOMDocument();
$dom->loadHTML($html);
$xpath = new DOMXPath($dom);
//Put your XPath Query here
$my_xpath_query = "/html/body/div[@id='container']/div[@id='contents']/div[@class='list' and @id='wrapper']/div[@class='main' and position()=1]/div[contains(@class, 'news-summary')]/div[@class='news-body']/h3";
$result_rows = $xpath->query($my_xpath_query);
//here we loop through our results (a DOMDocument Object)
foreach ($result_rows as $result_object){
echo $result_object->childNodes->item(0)->nodeValue;
}
?>