I’m trying to transcode xml to json and it’s not working, online services recode my xml without problems, for example this one .
My code is:
<?php //подгружаю xml файл $xml = simplexml_load_file('https://accounts.clickbank.com/api2/marketplace'); //перевожу его из xml в json $json = json_encode($xml); //формирую массив из json $data = json_decode($json,TRUE); //$data = json_encode($jsonString, TRUE); //проверяю как сформировался массив var_dump($data); ?> With $data = json_decode($json,TRUE); bool error (false)
for $data = json_encode($jsonString, TRUE); error string (4) "null"
Please help me figure it out.
$json = json_encode($xml, 'UTF-8', true);NULL Another addedheader('Content-Type: application/json; charset=utf-8');- MicroRuvar_dump($xml);- u_mulder