hi,

i have function to log in form
it should store cookies data in cookies.txt to using it in th next page
but it does not work

PHP Code:
$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg';
    
$headers[] = 'Connection: Keep-Alive';
    
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8';
    

    
$ch curl_init();

    
curl_setopt($chCURLOPT_URL$link);
    
curl_setopt($chCURLOPT_HTTPHEADER$headers);
    
curl_setopt($chCURLOPT_REFERER$referal);
    
curl_setopt($chCURLOPT_USERAGENT'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)');
    
curl_setopt($chCURLOPT_TIMEOUT'10');
    
curl_setopt($chCURLOPT_POST1);
    
curl_setopt($chCURLOPT_POSTFIELDS,$data);
    
curl_setopt($chCURLOPT_COOKIEJAR"cookies.txt");
    
curl_setopt($chCURLOPT_COOKIEFILE"cookies.txt");
    
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
    
curl_setopt($chCURLOPT_RETURNTRANSFER1);
    
curl_setopt($chCURLOPT_HEADER0);
    
$store curl_exec($ch); 
the log in successful but not store any data in cookies.txt
so i can't moved to the next page

i tested to store data using fwrite in cookies.txt and its success