Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

php xml to json

foreach($xml->children() as $state)
{
    $states[]= array('state' => (string)$state->name); 
}       
echo json_encode($states);
Comment

convert xml to json php

$xml = simplexml_load_string($xml_string);

// convert to json
$json = json_encode($xml);

// make array
$array = json_decode($json,TRUE);
Comment

PREVIOUS NEXT
Code Example
Php :: toastr in php 
Php :: codeigniter validation text length 
Php :: mysqli real escape string 
Php :: laravel collection collapse 
Php :: laravel has many with ids 
Php :: check current user role 
Php :: switch between php version ubuntu 
Php :: how-to-generate-an-xlsx-using-php 
Php :: Displaying Custom Navigation Menus in WordPress Themes 
Php :: smarty php 
Php :: php object is empty 
Php :: carbon if date is today 
Php :: how to create foreign key in laravel 
Php :: laravel Access to HMLHttpRequest from origin has been blocked by CORS policy: No Access-Control-Allow-Origin 
Php :: Creating (Declaring) PHP Variables 
Php :: php <= 
Php :: install phpmyadmin ubuntu 18.04 
Php :: laravel db raw count where 
Php :: laravel eloquent get all where in 
Php :: laravel how can I use the same foreign key twice in a single table 
Php :: php epoch conversion 
Php :: eloquent insert into select 
Php :: file get content php post 
Php :: remove space and line from json in php 
Php :: Laravel return empty relationship on model when condition is true 
Php :: laravel check if environment is production 
Php :: sms laravel 
Php :: twig in array 
Php :: install all php extensions ubuntu 20.04 
Php :: Woocommerce Changing the Entry Title of the Custom Endpoint 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =