API

This sections demonstrates the use of the API interface to communicate directly with supported devices.

Request Parameter

The LIST_SERVER_PROFILE parameter is used to get all available configurations assign to a user account.

Request = LIST_SERVER_PROFILE

Parameters

Description

username

User email address of the account to retrieve all server configuration profile.


Example usage :

<?php 


/**
 * Zerhex Sample API Call
 *
 * @package    Zerhex Digital
 * @author     Zerhex <developer@zerhex.com>
 * @copyright  Copyright (c) Zerhex Digital 20013-2018
 * @link       http://www.zerhex.com/
 */


$API_URL = "https://www.streamerportal.com/api/api.php";

//POST VARIABLES
$postfields['key'] = '8784lahho0775a00zhj9z704a0a5'; //API KEY
$postfields['hash'] = 'dssa65sta288878221est';       //API secret hash
$postfields['Request'] = 'LIST_SERVER_PROFILE';
$postfields['username'] = 'demo@example.com';


// Call the API
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
$response = curl_exec($ch);
if (curl_error($ch)) {
    die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
}
curl_close($ch);

// Decode response
$jsonData = json_decode($response,true);

//print return data of page.
echo '<pre>';
print_r($jsonData);
echo '</pre>';


?>

Sample Response

<?php 
Array
(
    [success] => 1
    [ret_code] => SUCCESS
    [msg] => 3 SERVER PROFILE FOUND AND IS NOW SHOWING.
    [response] => Array
        (
            [profile] => Array
                (
                    [0] => Array
                        (
                            [id] => 97
                            [userid] => 493
                            [deviceid] => 0
                            [title] => THIRD Studio
                            [username] => demo@example.com
                            [server] => example.com
                            [serverip] => 93.184.216.34
                            [servertype] => SHOUTCASTV2
                            [port] => 8002
                            [mountpoint] => /live
                            [pass] => password
                            [url] => 
                            [genre] => 
                            [bitrate] => 128
                            [sample] => 44100
                            [channel] => 0
                            [contenttype] => AUDIO/MPEG
                            [description] => 
                        )

                    [1] => Array
                        (
                            [id] => 96
                            [userid] => 493
                            [deviceid] => 0
                            [title] => SEC Studio
                            [username] => demo@example.com
                            [server] => example.com
                            [serverip] => 93.184.216.34
                            [servertype] => SHOUTCASTV1
                            [port] => 8001
                            [mountpoint] => /live
                            [pass] => password
                            [url] => 
                            [genre] => 
                            [bitrate] => 128
                            [sample] => 44100
                            [channel] => 0
                            [contenttype] => AUDIO/MPEG
                            [description] => 
                        )

                    [2] => Array
                        (
                            [id] => 95
                            [userid] => 493
                            [deviceid] => 0
                            [title] => Main Studio
                            [username] => source
                            [server] => example.com
                            [serverip] => 93.184.216.34
                            [servertype] => ICECAST
                            [port] => 8001
                            [mountpoint] => /live
                            [pass] => password
                            [url] => 
                            [genre] => 
                            [bitrate] => 128
                            [sample] => 44100
                            [channel] => 2
                            [contenttype] => AUDIO/MPEG
                            [description] => 
                        )

                )

            [selected] => Array
                (
                    [0B0B0B0B0B0B] => Array
                        (
                            [profileid] => 97
                            [title] => THIRD Studio
                        )

                )

            [profile_count] => 3
        )

)

?>