wildbest - 11:57 am on Dec 16, 2010 (gmt 0)
Its just the one complete code extract with the header data it generates.
Okay, then there are several issues you might want to look into, including the following:
1. As coopster said CURLOPT_FOLLOWLOCATION needs to be on to follow redirects. Check your CURLOPT_MAXREDIRS default value.
2. I don't see how do you actually create $cookiefile. Be careful how you handle the open/read/write/close permissions. By using CURLOPT_COOKIEFILE you actually activate the curl cookie parser and curl will automatically handle all cookies in a single curl transaction WITHOUT such a file even exists! This is why your code might have worked with other websites, but is generating an error with this one.
3. It's possible to use multiple instances of CURLOPT_URL in one curl_exec transaction (as your case might be). However, curl's persistent connection capability can be used if ONLY all the URLs are on the same host! If you have a redirect for your second (PUT) request, I'm afraid, you have to use more than one curl_exec/curl_close transaction and store the cookies in between.
4. To collect cookies received with your first (GET) request, set the CURLOPT_COOKIEJAR. Then use CURLOPT_COOKIEFILE in your second (PUT) curl transaction to recall them. But along with CURLOPT_POSTFIELDS you must use CURLOPT_POST. This is why you should uncomment [//curl_setopt($ch, CURLOPT_POST, true);].
5. The use of "Login.aspx" both in CURLOPT_URL and CURLOPT_REFERER can be an issue, although I'm not 100% sure.
6. Depending on configuration of the website under question and use of doPostBack functions, the use of CURLOPT_HTTPHEADER may be needed. You have to figure out what headers browser must send and create the respective array to be sent along with the PUT request.
Let us know if that helps and if it does, please post a working example of your code here.