PHP code example of utelecom / api-prostotv-php

1. Go to this page and download the library: Download utelecom/api-prostotv-php 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/ */

    

utelecom / api-prostotv-php example snippets



$api = new UTG\ProstoTV('login', 'password');

$object = $api->post('/objects', ['first_name' => 'Иван', 'last_name' => 'Иванов']);

$api->post('/objects/'.$object['id'].'/operations', ['operation_id' => 42, 'sum' => 100]);

$api->post('/objects/'.$object['id'].'/services', ['id' => 64]);

$api->post('/objects/'.$object['id'].'/devices');

$api->post('/objects/'.$object['id'].'/playlists');

$object = $api->get('/objects/'.$object['id']);

$api->delete('/objects/'.$object['id'].'/playlists'.$object['playlists'][0]['id']);

$api->delete('/objects/'.$object['id'].'/devices'.$object['devices'][0]['id']);

if ( $object = $api->get('/objects/'.$id) ) {
    // ...
} else {
    echo "Ошибка!\nСтатус: " . $api->status . "\nОтвет: " . json_encode($api->error) . "\n";
}