item($i); $url = $href->">

$html = file_get_contents('http://www.www.tseox.com/sitemap.html');

$dom = new DOMDocument();

@$dom->loadHTML($html);

// grab all the on the page

$xpath = new DOMXPath($dom);

$hrefs = $xpath->evaluate("/html/body//a");

for ($i = 0; $i < $hrefs->length; $i++) {

$href = $hrefs->item($i);

$url = $href->getAttribute('href');

echo $url.'
';

}

?>

本案例用于获取网站sitemap里面的所有连接提交到站长后台。如果获取页面的链接需要拼接一下变量加上网址!