【发布时间】:2011-11-30 16:55:56
【问题描述】:
我尝试解析 XML RSS 通量。实际上,抛出了一个错误:
Catchable fatal error: Object of class DOMElement could not be converted to string in ...
我想获取标签“link”的值“test”
这是我的代码:
//check if url contents xml
$content = file_get_contents($flux);
$xml = new DOMDocument;
$xml->loadXML($content);
//get the link
$link = $xml->getElementsByTagName('link')->item(0);
echo $link;
这是通量:
<?xml version="1.0" encoding="ISO-8859-15" ?>
<rss version="2.0">
<channel>
<title>test</title>
<link>http://test.fr</link>
</channel>
</rss>
谁能帮帮我?
【问题讨论】:
标签: php xml-parsing domdocument