Goutte icon indicating copy to clipboard operation
Goutte copied to clipboard

How to intercept file to download

Open foxtrails opened this issue 8 years ago • 1 comments

Hi Team,

Firstly, thanks in advance for your help here, it's really appreciated!

I've successfully managed to get Goutte to authenticate, hit a URL, change a select field and click a submit button.

The page then reloads and as it finishes loading, it downloads a file to the client.

How do I intercept this file within Goutte? I've read as much doco as I can but can't seem to find an answer. I then want to basically hit this file, traverse it and save it locally.

Depending upon the file type, I want to traverse it, or save it locally.

Thanks :-)

foxtrails avatar Feb 23 '17 00:02 foxtrails

Hi @foxtrails - did you ever resolve your issue? my thought would be that you'll want to implement this insomething like Insomnia Rest client or POSTMAN app, check the http headers which come back on the response, are they holding a 301 redirect, or, is there some client javascript firing to get the file? My gut reaction is that in your case the server is sending a 301 redirect which is instructing the browser to hit the file directly and as a result downloads it

TakesTheBiscuit avatar Oct 05 '17 09:10 TakesTheBiscuit