curl http验证

function get_http($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($ch, CURLOPT_USERPWD, 'username:password');
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}

 

posted @ 2018-08-14 10:26  zrn  阅读(1039)  评论(0编辑  收藏  举报