- str_replace: documentation ( source)
- explode: documentation ( source)
- trim: documentation ( source)
- header: documentation ( source)
- simplexml_load_file: documentation ( source)
<?php
header("Content Type: text/plain");
$xml = simplexml_load_file("https://upload.wikimedia.org/wikipedia/commons/c/c8/Municipalities_in_OG.svg");
foreach($xml->children() as $child) {
if ($child->getName() == "text") {
$matrix = $child->attributes();
$matrix = str_replace(array("matrix(1 0 0 1 ", ")"), "", $matrix);
$matrix = explode(" ", $matrix);
// here we go
$stationName = trim(str_replace(array("%%", '’'), array('\n', "'"), $child), " ");
$x = $matrix[0];
$y = $matrix[1];
// your business logic here
// echo($stationName);
} }