PHP code example of azuracast / nowplaying

1. Go to this page and download the library: Download azuracast/nowplaying library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

azuracast / nowplaying example snippets



// Example PSR-17 and PSR-18 implementation from Guzzle 7
// Install those with:
//   composer    $httpFactory,
    $httpFactory,
    new GuzzleHttp\Client
);

$adapter = $adapterFactory->getAdapter(
    NowPlaying\Enums\AdapterType::Shoutcast2,
    'http://my-station-url.example.com:8000'
);

// You can also call:
// $adapterFactory->getShoutcast2Adapter('http://url');

// Optionally set administrator password
$adapter->setAdminUsername('admin'); // "admin" is the default
$adapter->setAdminPassword('AdminPassword!');

// The first argument to the functions is the mount point or
// stream ID (SID), to pull one specific stream's information.
$now_playing = $adapter->getNowPlaying('1');

$clients = $adapter->getClients('1');