Wowza Community

Basic Authentication is not working

Hi Charlie,

I just notice that the basic authentication is not working on the wowza vhost, when I set the authentication method to basic it just set to none or no authentication, I need to change the Digest method to basic method because I want my php script to grab xml info and display it on the site, the digest method is a little complicated and random so I prefer the basic method

I also tried to create another method on the authentication.xml for basic just like below



Admin Basic Authentication





Wowza Media Systems


Both admin.password and publish.password has been set also

We only support digest for HTTP authentication at this time. We may add basic in a future release.


There is some example code here on how to do digest auth while fetching URL’s using file_get_contents.


Hi christr,

Thanks a lot, this is perfect , I did googling out this code for several days already but no luck, I did modify the code to fit on my needs, below is what I have come out, I added code sanitation to eliminate those extra header response from server so that only pure xml will be feed to xmlDOM.


<?php $retstr=readHTTPDigestAuthenticatedFile("SERVERIP","8086","connectioncounts/","USERNAME","PASSWORD"); //grab only the xml content $GrabStart = ''; $GrabEnd = ''; $GrabData = eregi("$GrabStart(.*)$GrabEnd", $retstr, $DataGrabed); $xml_data="<?xml version=\"1.0\"?>".$DataGrabed[1]."";

$doc = new DOMDocument();


$wms = $doc->getElementsByTagName(‘WowzaMediaServer’);

$currentlistener = $wms->item(0)->getElementsByTagName(“ConnectionsCurrent”)->item(0)->nodeValue;

$listenerhits = $wms->item(0)->getElementsByTagName(“ConnectionsTotal”)->item(0)->nodeValue;

echo “Current Listeners: $currentlistener
Connection Count: $listenerhits”;

function readHTTPDigestAuthenticatedFile($host,$port,$file,$username,$password)


if (!$fp=fsockopen($host,$port, $errno, $errstr, 15))

return false;

//first do the non-authenticated header so that the server

//sends back a 401 error containing its nonce and opaque

$out = “GET /$file HTTP/1.1\r\n”;

$out .= “Host: $host\r\n”;

$out .= “Connection: Close\r\n\r\n”;

fwrite($fp, $out);

//read the reply and look for the WWW-Authenticate element

while (!feof($fp))


$line=fgets($fp, 512);

if (strpos($line,“WWW-Authenticate:”)!==false)




//split up the WWW-Authenticate string to find digest-realm,nonce and opaque values

//if qop value is presented as a comma-seperated list (e.g auth,auth-int) then it won’t be retrieved correctly

//but that doesn’t matter because going to use ‘auth’ anyway



foreach ($authlinearr as $el)



//the substr here is used to remove the double quotes from the values



//these are all the vals required from the server


$opaque=$autharr[‘qop’]; //opaque

$drealm=$autharr[‘Digest realm’];

//client nonce can be anything since this authentication session is not going to be persistent

//likewise for the cookie - just call it MyCookie


//calculate the hashes of A1 and A2 as described in RFC 2617



//calculate the response hash as described in RFC 2617

$concat = $ha1.’:’.$nonce.’:00000001:’.$cnonce.’:auth:’.$ha2;


//put together the Authorization Request Header

$out = “GET /$file HTTP/1.1\r\n”;

$out .= “Host: $host\r\n”;

$out .= “Connection: Close\r\n”;

$out .= “Cookie: cookie=MyCookie\r\n”;

$out .= “Authorization: Digest username=”$username", realm="$drealm", qop=“auth”, algorithm=“MD5”, uri="/$file", nonce="$nonce", nc=00000001, cnonce="$cnonce", opaque="$opaque", response="$response"\r\n\r\n";

if (!$fp=fsockopen($host,$port, $errno, $errstr, 15))

return false;

fwrite($fp, $out);


//read in a string which is the contents of the required file

while (!feof($fp))


$str.=fgets($fp, 512);



return $str;




Thanks also charlie, at least now I will only use Digest type authentication method