Answer the question
In order to leave comments, you need to log in
How to encode XML to JSON?
I'm trying to recode xml to json and nothing happens, online services recode my xml without problems, like this one .
I am getting bool(false) or string(4) "null" error
My code is:
<?php
header('Content-Type: application/json; charset=utf-8');
//подгружаю 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);
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question