In the browser, navigating to this URL initiates a 302 (moved temporarily) request which in turn downloads a file.
http://www.targetsite.com/target.php/?event=download&task_id=123
When I view what is actually happening via Chrome network tools I see that the redirect is going to a dynamically generated path that cancels itself immediately after download. In other words, even if I know that full path I will not have time to manually call it.
So, how in using the command line can I mimic the browser actions?
I tried
curl --cookies bin/cookies.txt -O -L "http://www.targetsite.com/target.php/?event=download&task_id=123" --compressed
but this just returns gibberish. The goal of this is to programmatically download this file without having to navigate to the site. Unfortunately I cannot share the site here as it is behind a log-in.