simplexml_load_file()
當URL包含&符號時不加載XML文件。我已經嘗試了兩個例子有和無符號:使用simplexml_load_file在URL中出現問題
$source1 = simplexml_load_file("http://www.isws.illinois.edu/warm/data/outgoing/nbska/datastream.aspx?id=ncu");
print_r($source1); //works
$source2 = simplexml_load_file("http://forecast.weather.gov/MapClick.php?lat=38.8893&lon=-77.0494&unit=0&lg=english&FcstType=dwml");
print_r($source2); //no output
第一個例子效果很好,因爲它不包括符號,但因爲它包含符號的第二個例子是行不通的。
我參考了 simplexml_load_file with & (ampersand) in url with Solr和simplexml_load_file ampersand in url但它沒有工作。