我有一个示例代码:
<?php
header('Content-Type: text/html; charset=utf-8');
$doc = new DOMDocument();
$doc->load('http://www.haivl.com/rss');
$items = $doc->getElementsByTagName('item');
foreach ($items as $key => $item) {
$titles = $item->getElementsByTagName( "title" );
$title = $titles->item(0)->nodeValue;
echo $title;
}
?>
我无法从此网址获取标题,为什么会出错,可以帮我解决这个错误!