PHP code example of openpublicmedia / pbs-media-manager-php
1. Go to this page and download the library: Download openpublicmedia/pbs-media-manager-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 / pbs-media-manager-php example snippets
use OpenPublicMedia\PbsMediaManager\Client;
$api_key = 'xxxxxxxxxxxxxx';
$api_secret = 'xxxxxxxxxxx';
$client = new Client($api_key, $api_secret);
$franchises = $client->getFranchises();
foreach ($franchises as $franchise) {
var_dump($franchise);
class stdClass#45 (4) {
public $links => class stdClass#40 (4) { ... }
public $attributes => class stdClass#39 (18) { ... }
public $type => string(9) "franchise"
public $id => string(36) "e08bf78d-e6a3-44b9-b356-8753d01c7327"
}
}
$episode = $client->getEpisode('08e7ee9c-800a-406f-86f0-bf0bb77fe42b');
var_dump($episode);
class stdClass#80 (3) {
public $attributes => class stdClass#38 (20) { ... }
public $id => string(36) "08e7ee9c-800a-406f-86f0-bf0bb77fe42b"
public $type => string(7) "episode"
}
$results = $client->searchEpisodes('Seattle');
foreach ($results as $result) {
var_dump($result);
class stdClass#45 (4) {
public $links => class stdClass#40 (4) { ... }
public $attributes => class stdClass#39 (18) { ... }
public $type => string(9) "episode"
public $id => string(36) "bb053151-7d3f-42bd-ac69-d0c19f040b27"
}
}
$results = $client->searchAssets([
'show-title' => 'Mossback',
'episode-title' => ['Seattle', 'came'],
]);
var_dump(count($results));
int(4)
foreach ($results as $r) {
print "{$r->id}\t{$r->attributes->title}\r\n";
}
4eb40f99-cd4f-4582-9e8a-1ef0a99b8293 When Camelot Came to the Seattle World's Fair
e96d66c4-aa8e-4a83-a060-bd712178ff6b The Music Festival That Came Before Woodstock
884e4401-de5e-4423-8cab-1c611dd6e624 When Mark Twain Came to Seattle
73d7b2fe-111b-4318-8721-e93937bf22ea When the ‘American Hitler’ Came to Washington