我正在尝试解析 XML 并打印标签,但我收到错误消息。
致命错误:调用未定义的方法 DOMNodeList::getElementsByTagName()
<?
$doc = new DOMDocument();
$doc->load('http://www.espncricinfo.com/rss/content/story/feeds/0.xml');
$item = $doc -> getElementsByTagName('item');
$title = $item->getElementsByTagName('title');
$titles = $title->item(0)->nodeValue;
echo "<h2>$titles</h2>"
?>