1
我有以下網址:打開XML文件並獲取特定內容?
http://en.wikipedia.org/wiki/Special:Export/Birkdale,_Queensland
我想下面出來的:
pop = 13,460 (2006 census)
lga = Redland City
dist1 = 44
near-nw = [[Thorneside, Queensland|Thorneside]]
| near-n =
| near-ne = [[Wellington Point, Queensland|Wellington Point]]
| near-w = [[Ransome, Queensland|Ransome]]
| near-e = [[Wellington Point, Queensland|Wellington Point]]
| near-sw = [[Capalaba West, Queensland|Capalaba West]]
| near-s = [[Capalaba, Queensland|Capalaba]]
| near-se = [[Alexandra Hills, Queensland|Alexandra Hills]]
我想他們回來作爲變量,例如:
$pop = "13,460 (2006 census)";
$lga = "Redland City";
$distance = 44;
$nearnw = "Thorneside";
$nearn = "";
$nearne = "Wellington Point";
$nearw = "Ransome";
$neare = "Wellington Point";
$nearsw = "Capalaba West";
$nears = "Capalaba";
$nearse = "Alexandra Hills";
我該如何解決從這個XML文件中提取信息並將它們放入上面解釋過的變量中?
謝謝。
我想這一點,我得到的錯誤,如:未能打開流:HTTP請求失敗! HTTP/1.0 403嘗試時禁止。 – Latox
@kyle我希望你在url中使用了正確的鏈接。另一種方法是使用cURL,而php.net文檔就是你所需要的 – Ibu