$fields_string = 'login=vasya&pass=q1w2e3&submit=ok';
$ch = curl_init();
curl_setopt_array( $ch, $options );
curl_setopt($ch,CURLOPT_URL,'http://site.ru');
curl_setopt($ch,CURLOPT_POST,count(explode('&',$fields))); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch,CURLOPT_COOKIEJAR, $kfName);
curl_setopt($ch,CURLOPT_COOKIEFILE, $kfName);
$result = curl_exec($ch);