0

My application's backend in PHP sends HTTP requests to other servers and receives large responses from them.

At the moment I'm using curl_setopt($curlResource, CURLOPT_FILE, $fileResource); to avoid storing the response in memory so I don't have to increase memory limits for the script.

What I want to achieve is for my script to receive the HTTP response from other server and to process it in real-time, discarding pieces of data already processed.

Is it even possible without something fancy like a socket connection to ports 80 or 443 to receive data without the help of CURL?

sp-niemand
  • 225
  • 4
  • 10

1 Answers1

1

Brief answer: use your own custom stream object as a CURLOPT_FILE.

You can find more info here: https://stackoverflow.com/a/1342760/227884 .

Community
  • 1
  • 1
sp-niemand
  • 225
  • 4
  • 10