我使用下面的函数如何遍历XML在PHP
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$myTestingUrl = file_get_contents_curl("myUrl");
我运行的功能我有
$myTestingUrl =
<?xml version="1.0" encoding="UTF-8"?>
<map>
<entry key="keyName">
<entry key="ActionUrl">http://www.my_actionUrl.com/</entry>
</entry>
</map>
能否请你告诉我,我怎么可以遍历$ myTestingUrl拿到后入门键“ActionUrl”(http://www.my_actionUrl.com/)中的一个变量在php中的内容?
谢谢!
可能重复[在PHP中遍历XML](http://stackoverflow.com/questions/6301084/traversing-xml-in-php) – ajreal