I have a web-service that gets a file and returns it to the user (based on Symfony). Ever since I used curl to do this.
I just found guzzlehttp and it seems great. How
public function streamAction()
{
$response = $client->request(
'GET', 'http://httpbin.org/stream-bytes/1024', ['stream' => true]
);
$body = $response->getBody();
$response = new StreamedResponse(function() use ($body) {
while (!$body->eof()) {
echo $body->read(1024);
}
});
$response->headers->set('Content-Type', 'text/xml');
return $response;
}