PHP code example of openpublicmedia / engaging-networks-php

1. Go to this page and download the library: Download openpublicmedia/engaging-networks-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/ */

    

openpublicmedia / engaging-networks-php example snippets


use OpenPublicMedia\EngagingNetworksServices\Rest\Client;

$base_uri = 'https://ca.engagingnetworks.app/ens/service/';
$api_key = '11111111-2222-3333-4444-555555555555';

$client = new Client($base_uri, $api_key);

use OpenPublicMedia\EngagingNetworksServices\Rest\Client;
use Tochka\Cache\ArrayFileCache;

$base_uri = 'https://ca.engagingnetworks.app/ens/service/';
$api_key = '11111111-2222-3333-4444-555555555555';

$cache = new ArrayFileCache('.', 'my_awesome_cache');
$client = new Client($base_uri, $api_key, cache: $cache);

use OpenPublicMedia\EngagingNetworksServices\Rest\Client;
use Tochka\Cache\ArrayFileCache;

$base_uri = 'https://ca.engagingnetworks.app/ens/service/';
$api_key = '11111111-2222-3333-4444-555555555555';

$cache = new ArrayFileCache('.', 'my_awesome_cache');
$client = new Client(
  $base_uri,
  $api_key,
  cache: $cache,
  cache_key_token: 'open_public_media.ens.rest.session_token_server_1',
  cache_key_token_expire: 'open_public_media.ens.rest.session_expire_server_1'
);

use OpenPublicMedia\EngagingNetworksServices\Rest\Client;
use Tochka\Cache\ArrayFileCache;

$base_uri = 'https://ca.engagingnetworks.app/ens/service/';
$api_key = '11111111-2222-3333-4444-555555555555';

$cache = new ArrayFileCache('.', 'my_awesome_cache');
$client = new Client(
  $base_uri,
  $api_key,
  cache: $cache,
  cache_key_token: 'open_public_media.ens.rest.session_token_server_2',
  cache_key_token_expire: 'open_public_media.ens.rest.session_expire_server_2'
);

use OpenPublicMedia\EngagingNetworksServices\Rest\Client;

$base_uri = 'https://ca.engagingnetworks.app/ens/service/';
$api_key = '11111111-2222-3333-4444-555555555555';

$client = new Client($base_uri, $api_key);
try {
    $results = $client->getPages(PageType::dc);
} catch (Exception $e) {
    var_dump(get_class($e));
    var_dump($e->getMessage());
    var_dump($e->getCode());
    var_dump($e->getErrorMessage());
    var_dump($e->getErrorMessageId());
}
bash
composer