CURL HTTP验证

CURL HTTP验证


	function get_http($url){

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

      //HTTP验证
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);**

    curl_setopt($ch, CURLOPT_USERPWD, 'xx');

	  //SSL 验证
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);**

    //curl_setopt($ch, CURLINFO_HEADER_OUT, true);

    $data = curl_exec($ch);

    curl_close($ch);

    return $data;

}

你可能感兴趣的:(学习笔记)