<?php
$response = "0;78d13qqoglyszmorspfwfdmwffgnubgr;\u003c?dpf sent len=\"1\"?\u003e\u003c?dpf orth code=\"unknown\" prop=\"Lesen;Lehnen;Lehren;Leasen;Leisen\" ?\u003elehsen\u003c?dpf /orth ?\u003e~~~\u003c?dpf /sent ?\u003e";
$response = preg_replace("/\\\\u([0-9a-f]{3,4})/i", "&#x\\1;", $response);
$response = html_entity_decode($response , null, 'UTF-8');
$response = str_replace([ '<?dpf ', ' ?>', '?>' ], [ '<', '>', '>' ], $response);
$response = substr($response, 36-1);
echo $response;
echo "\n";
$xml = simplexml_load_string($response );
$xml = toArray($xml);
print_r($xml);
function toArray($xml) {
$array = json_decode(json_encode($xml), true);
foreach ( array_slice($array, 0) as $key => $value ) {
if ( empty($value) ) $array[$key] = NULL;
elseif ( is_array($value) ) $array[$key] = toArray($value);
}
return $array;
}
preferences:
41.35 ms | 402 KiB | 5 Q