2

I have an API response where sizes vary. It doesn't show error on large xml data(appx. 20MB), when I try to convert the xml object into std object using. This is my code

$xml = simplexml_load_string($apiResponse);
$object = json_decode(json_encode($xml));

Error Message is:

simplexml_load_string(): Entity: line 1: parser error : internal error: Huge input lookup

I google and found this answer on stackoverflow and changed my code to

simplexml_load_string($apiResponse, 'SimpleXMLElement', LIBXML_PARSEHUGE)

But, error is still same. Anyone has got any Idea? Thank you in advance

Community
  • 1
  • 1
VijayRana
  • 953
  • 1
  • 13
  • 38
  • Not related to your problem, but please don't use `$object = json_decode(json_encode($xml));`. You're basically throwing away [all the convenience features that make SimpleXML useful](http://php.net/manual/en/simplexml.examples-basic.php), and potentially also throwing away data (because XML and JSON can't neatly express the same structures). – IMSoP Feb 27 '17 at 14:33
  • Yes, thank you for the suggestion @IMSoP. I will try to implement it. BTW Is there any solution to my problem currently facing? – VijayRana Feb 28 '17 at 05:15
  • Did this ever get answered ?? – MB. Dec 08 '20 at 14:17

0 Answers0