php Http authorization 用户身份验证
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
}else{
echo $_SERVER['PHP_AUTH_USER'];
echo $_SERVER['PHP_AUTH_PW'];
die();
}
访问网页
HTTP 弹框要求输入密码 也可以使用 header 头存储密码
`Authorization: Basic base64(帐号:密码)
Accept: text/html, application/xhtml+xml, image/jxr, */*
Accept-Language: en-US,en;q=0.8,zh-Hans-CN;q=0.5,zh-Hans;q=0.3
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
Authorization: Basic YWRtaW46YWRtaW4=
或者
http://admin:password@192.168.1.104:554/11