Beispiel #1
0
$index = 0;
foreach ($xml->Document->Placemark as $data) {
    $cleancoords = explode(",", $data->Point->coordinates);
    $cleanname = explode(":", $data->name);
    $cleandesc = explode("\n", str_replace("'", "", $data->description));
    $statuskey = strinarray('Status', $cleandesc);
    $hubkey = strinarray('Hub', $cleandesc);
    $cleanstatus = strip_tags($cleandesc[$statuskey]);
    $statuscode = explode(" ", $cleanstatus);
    $idkey = strinarray('ID', $cleandesc);
    $speedkey = strinarray('Current speed', $cleandesc);
    $notekey1 = strinarray('Modem has been', $cleandesc);
    $notekey2 = strinarray('Es', $cleandesc);
    $notekey3 = strinarray('Total', $cleandesc);
    $notekey4 = strinarray('Inbound', $cleandesc);
    $notekey5 = strinarray('Ou', $cleandesc);
    $cleanid = explode(" ", $cleandesc[$idkey]);
    $cleanspeed = explode(" ", $cleandesc[$speedkey]);
    $kvhdata[$index]['name'] = trim($cleanname[1]);
    $kvhdata[$index]['latitude'] = $cleancoords[1];
    $kvhdata[$index]['longitude'] = $cleancoords[0];
    $kvhdata[$index]['speed'] = $cleanspeed[3] * 1.852;
    $kvhdata[$index]['ipaddr'] = substr($cleanname[0], 0, -7);
    $kvhdata[$index]['id'] = substr($cleanid[2], 0, -3);
    $kvhdata[$index]['status'] = $cleanstatus;
    if ($statuscode[4] == 'In') {
        $kvhdata[$index]['statuscode'] = "40000";
    } else {
        $kvhdata[$index]['statuscode'] = "40002";
    }
    $kvhdata[$index]['notes'] = strip_tags($cleandesc[$hubkey]) . "<br />" . strip_tags($cleandesc[$speedkey]) . "<br />" . strip_tags($cleandesc[$notekey1]) . "<br />" . strip_tags($cleandesc[$notekey2]) . "<br />" . strip_tags($cleandesc[$notekey3]) . "<br />" . strip_tags($cleandesc[$notekey4]) . "<br />" . strip_tags($cleandesc[$notekey5]);
// Parse returned XML
$index = 0;
foreach ($xml->Document->Placemark as $data) {
    $cleancoords = explode(",", $data->Point->coordinates);
    $cleanname = explode(" ", $data->name);
    $cleandesc = explode("\n", $data->description);
    print_r($cleandesc);
    $statuskey = strinarray('Status', $cleandesc);
    echo $statuskey . "\n\r";
    $cleanstatus = strip_tags($cleandesc[$statuskey]);
    $statuscode = explode(" ", $cleanstatus);
    print_r($statuscode);
    $idkey = strinarray('ID', $cleandesc);
    $speedkey = strinarray('Current speed', $cleandesc);
    $notekey1 = strinarray('Modem has been', $cleandesc);
    $notekey2 = strinarray('Eb', $cleandesc);
    $cleanid = explode(" ", $cleandesc[$idkey]);
    $cleanspeed = explode(" ", $cleandesc[$speedkey]);
    $kvhdata[$index]['name'] = $cleanname[2];
    $kvhdata[$index]['latitude'] = $cleancoords[1];
    $kvhdata[$index]['longitude'] = $cleancoords[0];
    $kvhdata[$index]['speed'] = $cleanspeed[3] * 1.852;
    $kvhdata[$index]['ipaddr'] = $cleanname[0];
    $kvhdata[$index]['id'] = strip_tags($cleanid[2]);
    $kvhdata[$index]['status'] = $cleanstatus;
    if ($statuscode[4] == 'In') {
        $kvhdata[$index]['statuscode'] = "40000";
    } else {
        $kvhdata[$index]['statuscode'] = "40002";
    }
    $kvhdata[$index]['notes'] = strip_tags($cleandesc[$speedkey]) . "<br />" . strip_tags($cleandesc[$notekey1]) . "<br />" . strip_tags($cleandesc[$notekey2]);