0

I have a script in PHP which retrieves two very similar files and performs some tasks on the data then outputs a result. I'm currently using curl and getting one, processing it, then getting the other and processing it.

I want to switch to stream_socket_client as I've heard you can retrieve both files at the same time and do the processing once they have been retrieved but I am unsure how to do this.

hakre
  • 193,403
  • 52
  • 435
  • 836
Hintswen
  • 3,987
  • 12
  • 40
  • 45

1 Answers1

0

See this blog post. Basically, you open both sockets, call stream_set_blocking with false, and in a loop you call fread until both streams reach EOF.

Artefacto
  • 96,375
  • 17
  • 202
  • 225