PHP code example of streamlike / php-ws-sdk

1. Go to this page and download the library: Download streamlike/php-ws-sdk 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/ */

    

streamlike / php-ws-sdk example snippets




// via composer autoload
/src/streamlikeWs.php';


$ws = new streamlikeWs('https://cdn.streamlike.com', 'json');




try {
    $params = array(
      'company_id' => '48c6eab371919246',
    );

    $content = $ws->getResult('playlists', $params, streamlikeWs::RESULTTYPE_RAW);

    var_dump($content);
} catch (\Exception $e) {
    // handle exception, log, retry...
}



try {
    $ws = new streamlikeWs('https://cdn.streamlike.com', 'xml', streamlikeWs::VERSION_V2);
    $params = array(
      'company_id' => '48c6eab371919246',
      'media_id' => '4df5ede70f252c07',
      'value' => 3,
    );

    $content = $ws->setVote($params);
} catch (\Exception $e) {
    // handle exception, log, retry...
}




try {
    $ws = new streamlikeWs('https://cdn.streamlike.com', 'json');
    $params = array(
      'playlist_id' => '983e6509573f4849',
      'lng' => 'fr',
      'pagesize' => 6,
      'orderby' => 'creationdate',
      'sortorder' => 'down'
    );

    $content = $ws->getResult('playlist', $params);
} catch (\Exception $e) {
    // handle exception, log, retry...
}



try {
    $ws = new streamlikeWs('https://cdn.streamlike.com', 'xml');
    $params = array(
      'media_id' => '4df5ede70f252c07',
      'rate' => 'true',
    );

    $content = $ws->getResult('media', $params, streamlikeWs::RESULTTYPE_RAW);
} catch (\Exception $e) {
    // handle exception, log, retry...
}




try {
    $ws = new streamlikeWs('https://cdn.streamlike.com');
    $params = array(
      'media_id' => '4df5ede70f252c07',
    );

    $content = $ws->getResult('qr', $params);
} catch (\Exception $e) {
    // handle exception, log, retry...
}



try {
    $ws = new streamlikeWs('https://cdn.streamlike.com');
    $params = array(
      'media_id' => '4df5ede70f252c07',
    );

    $content = $ws->getResult('manifest', $params);
} catch (\Exception $e) {
    // handle exception, log, retry...
}



try {
    $ws = new streamlikeWs('https://cdn.streamlike.com');
    $params = array(
      'media_id' => '4df5ede70f252c07',
    );

    $content = $ws->getResult('nowplaying', $params);
} catch (\Exception $e) {
    // handle exception, log, retry...
}



try {
    $ws = new streamlikeWs('https://cdn.streamlike.com');
    $params = array(
      'playlist_id' => '983e6509573f4849',
      'lng' => 'fr',
      'orderby' => 'lastupdateddate',
    );

    $content = $ws->getResult('podcast', $params);
} catch (\Exception $e) {
    // handle exception, log, retry...
}



try {
    $ws = new streamlikeWs('https://cdn.streamlike.com');
    $params = array(
      'media_id' => '4df5ede70f252c07',
      'pagesize' => 4,
    );

    $content = $ws->getResult('related', $params);
} catch (\Exception $e) {
    // handle exception, log, retry...
}



try {
    $ws = new streamlikeWs('https://cdn.streamlike.com');
    $params = array(
      'company_id' => '48c6eab371919246',
    );

    $content = $ws->getResult('videositemap', $params);
} catch (\Exception $e) {
    // handle exception, log, retry...
}