PHP
x
24
24
1
function array2xml($array, $xml = false){
2
3
if($xml === false){
4
$xml = new SimpleXMLElement('<result/>');
5
}
6
7
foreach($array as $key => $value){
8
if(is_array($value)){
9
array2xml($value, $xml->addChild($key));
10
} else {
11
$xml->addChild($key, $value);
12
}
13
}
14
15
return $xml->asXML();
16
}
17
18
$raw_data = file_get_contents('http://pastebin.com/raw.php?i=pN3QwSHU');
19
$jSON = json_decode($raw_data, true);
20
21
$xml = array2xml($jSON, false);
22
23
echo '<pre>';
24
print_r($xml);