我有以下网址:
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文件中提取信息并将它们放入变量中,如上所述?
谢谢。
答案 0 :(得分:1)
您是否尝试过使用simplexml
$url = "http://en.wikipedia.org/wiki/Special:Export/Birkdale,_Queensland";
$xml = simplexml_load_file($url);