Wowza服务器的配置/设置是否必须正确以允许HTTP身份验证?
根据How to get realtime connection counts from Wowza Media Server,我应该能够获得一些我需要的XML信息。如果我从浏览器转到url,它会提示输入用户名/密码,我会得到数据,但如果我尝试从PHP完成它,无论我使用什么方法都会失败:
HTTP request failed! HTTP/1.0 401 Unauthorized
方法#1:
$data = file_get_contents('http://admin:password@123.123.123.123:8086/connectioncounts');
方法#2 :
$handle = fopen('http://admin:password@123.123.123.123:8086/connectioncounts', "r")
方法#3 :
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, http://123.123.123.123:8086/connectioncounts);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "admin:password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($ch);
答案 0 :(得分:3)
尝试将CURLAUTH_BASIC更改为CURLAUTH_ANY