Skip to main content

Wowza Streaming Engine REST API - Monitoring The Status of a STREAM File


This is a small PHP-CURL script, initiates a JSON request to Wowza API to get the realtime status of a STREAM file.

Note that the request is protected by Wowza 'AUTHENTICATION - DIGEST' Mechanism.

**********************************************************************
$wowzaip = '192.168.166.68'; //replace with your wowza ip address
$application = 'live'; //replace with your application name
$streamfile = '10-20160527134707366114.stream'; //replace with your streamfile

//initiate a curl session
$ch = curl_init();

//set http header to json
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Accept: application/json'));

//set wowza request url
curl_setopt($ch, CURLOPT_URL, 'http://'.$wowzaip.':8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/'.$application.'/instances/_definst_/incomingstreams/'.$streamfile.'/monitoring/current');

//set RETURNTRANSFER true. Now return as string instead of output
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

//authentication in wowza server
curl_setopt($ch, CURLOPT_USERPWD, "your_username:your_password");

//set HTTPAUTH to CURLAUTH_ANY, required for authentication
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);

//execute request
$output = curl_exec($ch);

//close curl session
curl_close($ch);

//echo the json output
echo $output;

**********************************************************************

Comments

Popular posts from this blog

MySql command line - Print query output containing large number of rows and columns

To print large dataset of records in user friendly way, use any of these options. Option1# (open the records in linux 'less' editor - line by line format)      mysql> pager less;      mysql> select * from table\G; Option2# (open the records in linux 'less' editor - table format)      mysql> pager less -SFX;      mysql> select * from table; Escape character of 'less' is 'q'