我嘗試解析XML rss flux。其實,拋出一個錯誤:DOMElement類的對象無法轉換爲字符串
Catchable fatal error: Object of class DOMElement could not be converted to string in ...
我想標籤「鏈接」
這裏的價值「測試」是我的代碼:
//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>
任何人都可以幫到我嗎?
可能的幫助:http://stackoverflow.com/questions/548744/php-xpath-question – diEcho