$cookie_file = tempnam('./temp','cookie');curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_file);