2013-03-28 56 views
0

我試圖讓下面的代碼工作。目前它只輸出一個空白頁面。SimpleXML沒有閱讀的URL

if($vUrlDetails = simplexml_load_file($vUrl)) { 
    // Do something 
} 

它,如果我使用file_get_contents()並將其保存到一個文件,然後使用simplexml_load_file()工作正常。

使用simplexml_load_file()通過URL加載XML文件是否有限制?

+0

您是否嘗試過'$ XML =使用simplexml_load_file($ vUrl '的SimpleXMLElement',LIBXML_NOCDATA);'? – user1190992

+0

@ user1190992,已經嘗試過,但沒有運氣。 – llanato

回答

1

我想你可以嘗試:

<?php 
    // http://www.php.net/manual/en/simplexmlelement.construct.php 
    $xml = new SimpleXMLElement('http://my.url.com/something.xml', 0, true); 
?> 
+0

完美,謝謝你。 – llanato