How To Download A File Using Curl ?

Hey Yii Community !

I need to retrieve a file from a site using Yii with a curl command. From the command line I would use

curl -X GET ‘http://www.site.com/report-download?id=123213123’ > foo.csv

How do I do the same thing inside Yii?




$jsonObject = Yii::app()->curl->setOption(CURLOPT_HTTPHEADER=>$auth)->get($report_url);




Will return a json object not the file? I am having a really tough time wrapping my brain around this.

Do I need to use some sort of stream or file creation?

Thanks for any guidance !