1

So I get a SoapClient response in XML that has 18000 entries. The request times out and I have to use :

ini_set('default_socket_timeout', 600);

But as I read online it seems like a bad practice and it is advised that I process the XML in batches.

Is that possible to do in PHP?

Compo
  • 36,585
  • 5
  • 27
  • 39
dimitrisr
  • 185
  • 1
  • 1
  • 6
  • I have removed the `batch-file` tag because there appears no correlation between batches and batch files. If you really need batch files then please [update your question](https://stackoverflow.com/posts/46755539/edit), explaining otherwise and re-add the tag as necessary. – Compo Oct 15 '17 at 14:16
  • Using XMLReader to split the file down, but then importing segments using SimpleXML is probably a good solution - have a read of https://stackoverflow.com/questions/1835177/how-to-use-xmlreader-in-php for a simple example. – Nigel Ren Oct 15 '17 at 14:23
  • So how does this reduce the time consumed by the socket? The socket takes times to download the initial XML. I would like the initial XML to be broken down into segments from the API I request it from. I would like to get 100 out of 18000 entries, then the next 100 .. – dimitrisr Oct 15 '17 at 14:45
  • With no information about the SOAP service your using, how can anyone else answer that question. Can you make a request for the range of information available and then make a set of calls to download it in segments. – Nigel Ren Oct 15 '17 at 16:58
  • Unless the service supports paging of datasets and/or you have the code to modify the service you will not be able to do this. This is something that has to be implemented SOAP does not specify this, or even allow such functionality implicitly. – Namphibian Oct 15 '17 at 21:43

0 Answers0