The XML file structure is as follows
PHP Code Resolution:
$url = "";//The URL of the output XML
$dom = new DOMDocument (' 1.0 ', ' utf-8 ');
$dom->load ($url);
So we capture the XML data, and then a little interception, this XML has multiple URL nodes, need to Dompath parsing
$xpath = new Domxpath ($dom);
$node = '//url ';
$length = $xpath->query ($node)->length;
And then get the data based on the byte points within each URL.
For ($i = 0; $i < $length; $i + +) {$data = array (); $m _date = date (' y-m-d ', strtotime ($xpath->query) ($node. ['. ($i + 1). ']
/date ')->item (0)->nodevalue)); $m _start = $xpath->query ($node. ['. ($i + 1). ']
/start ')->item (0)->nodevalue; $m _end = $xpath->query ($node. ['. ($i + 1). ']
/end ')->item (0)->nodevalue; $m _title = $xpath->query ($node. ['. ($i + 1). ']
/title ')->item (0)->nodevalue; $m _format = $xpath->query ($node. ['. ($i + 1). ']
/format ')->item (0)->nodevalue; $m _season = $xpath->query ($node. ['. ($i + 1). ']
/season ')->item (0)->nodevalue; $m _round = $xpath->query ($node. ['. ($i + 1). ']
/round ')->item (0)->nodevalue; /* $homeTeam = $xpath->query ($node. ' ['. ($i + 1). ']
/hometeam ')->item (0)->nodevalue;
if (empty ($homeTeam)) continue; $guestTeam = $xpath->query ($node. ' ['. ($i + 1). '] /guestteam '); Item (0)->nodevalue; if (empty ($guestTeam)) continue;*/ $homeTeam = $xpath->query ($node. ') ['. ($i + 1). ']
/hometeam ')->item (0)->nodevalue; $guestTeam = $xpath->query ($node. ' ['. ($i + 1). ']
/guestteam ')->item (0)->nodevalue; if (Empty ($guestTeam) | |
empty ($homeTeam)) {if ($m _title) {$temp _title=explode (" ", $m _title);
List ($homeTeam, $guestTeam) =explode ("vs", $temp _title[1]);
unset ($temp _title);
} if (empty ($homeTeam)) continue;
if (empty ($guestTeam)) continue; }