Curl returntransfer is empty, curl_getinfo “Error: 1”


Curl returntransfer is empty, curl_getinfo “Error: 1”

I try to get a page with curl from an IIS-Server which demands user authentication.
After execution it return null string. The script as given below.
$ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, base_url().'forum/heathhandler.php');
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $string = 'submit=1&action='.$action;
        if($data) {
            $string .= '&data='.$data;
        }
        curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
//      curl_setopt($ch, CURLOPT_HEADER, true);
                //curl_setopt($ch, CURLOPT_VERBOSE, true);
        $result = curl_exec( $ch );     
        curl_close($ch);
        return $result;

脚本输出如下所示

Array ([url] => http://192.168.4.45/matrix/forum/heathhandler.php [content_type] => text/html;utf - 8字符集= [http_code] => 200 [header_size] => 402 [requestrongize] => 445 [filetime] => 1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.422 [namelookup_time] => 0 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 294 [size_download] => 0 [speed_download] => 0 [speed_upload] => 206 [download_content_length] => 0 [upload_content_length] => 294 [starttransfer_time] => 1.422 [redirect_time] => 0 [redirect_url] => [primary_ip] => 192.168.4.45 [certinfo] =>数组()[primary_port] => 80 [local_ip] => 192.168.4.45 [local_port] => 53506) Error: 1

要通过基本身份验证,您可以

curl_setopt($process, CURLOPT_HTTPHEADER, 
             array('Content-Type: application/xml', $additionalHeaders));
curl_setopt($process, CURLOPT_HEADER, 1);
curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($process, CURLOPT_TIMEOUT, 30);

之前
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);