I have a feeling that my issue is a problem with my basic understanding of some of the HTTP nuances, but I will ask it here as a curl and php question.
I use a web application that can be used to store files, and if I use a browser to access a particular URI on the site, the browser will prompt me to store that file somewhere. Note that the URI is asp code that sends back the file (somehow), not a simple file path on the web server. Also, there appears to be a number of redirects that happen, but I am not sure if that is relevant because I have set the FOLLOWLOCATION option.
I am attempting to do that same thing using php and curl. My PHP code looks like:
$curlObj = curl_init($url);
curl_setopt($curlObj, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, FALSE);
$tempFile = tempnam("","aes"); # create a temp file
$tempFH = fopen($tempFile,"w");
curl_setopt($curlObj, CURLOPT_FILE, $tempFH);
curl_setopt($curlObj, CURLINFO_HEADER_OUT, TRUE);
curl_exec($curlObj);
print_r(curl_getinfo($curlObj));
curl_close($curlObj);
When I look at the contents of the temp file, it's always the equivalent of the html data that is visible in my browser when I go that site, but not the file the browser allows me to save. If I look at the htt header data and body, there is no reference to the file or its contents, so I am not sure how I would access it like the browser does.