Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php xml to json

$fileContents= file_get_contents($url);

$fileContents = str_replace(array("
", "
", "	"), '', $fileContents);

$fileContents = trim(str_replace('"', "'", $fileContents));

$simpleXml = simplexml_load_string($fileContents);

$json = json_encode($simpleXml);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #xml #json
ADD COMMENT
Topic
Name
6+5 =