PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Nov 17, 2019 6:46 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Mar 06, 2018 2:53 pm 
Offline
Forum Commoner

Joined: Mon Sep 27, 2004 10:56 am
Posts: 72


Top
 Profile  
 
PostPosted: Wed Mar 07, 2018 7:46 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US
Instead of this:
Syntax: [ Download ] [ Hide ]
            $xml = simplexml_load_file($file, "SimpleXMLElement", LIBXML_NOCDATA);

Do this:
Syntax: [ Download ] [ Hide ]
$json = file_get_contents($file);
$data = json_decode($json);

Also, why are you JSON encoding XML and then immediately decoding it?
Syntax: [ Download ] [ Hide ]
            $json = json_encode($xml);
            $data = json_decode($json, TRUE);

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group