0

I need to get and parse SOAP response, but SoapClient tells me like this:

Out of memory (allocated 387186688) (tried to allocate 87 bytes)

In other words, response is really huge so PHP (SoapClient) can't parse it. Is there any way to solve this problem? Thank you and sorry for my english.

  • You can either increase the allowed memory or split the request in parts. – Peon Oct 05 '17 at 08:00
  • Check & try one of these: https://stackoverflow.com/a/9633919/1155760 – CSharpRU Oct 05 '17 at 08:24
  • Look at XMLReader, this can give you a good balance of being able to use SimpleXML for ease of use, but working with chunks of the file as opposed to all of the file in one go. https://stackoverflow.com/questions/1835177/how-to-use-xmlreader-in-php has an example. – Nigel Ren Oct 05 '17 at 12:28

1 Answers1

0

You can either use http://php.net/manual/en/book.xml.php or http://php.net/manual/en/book.simplexml.php. Both libs stream the xml "line by line". So you have minor memory consumption. You are able to parse parts of a xml, too.

Oliver
  • 893
  • 6
  • 17