PHP code example of openpublicmedia / pbs-tv-schedules-service-php
1. Go to this page and download the library: Download openpublicmedia/pbs-tv-schedules-service-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-tv-schedules-service-php example snippets
use OpenPublicMedia\PbsTvSchedulesService\Client;
$api_key = 'xxxxxxxxxxxxxx';
$call_sign = 'xxxx';
$client = new Client($api_key, $call_sign);
$today = new DateTime();
$results = $client->getListings($today);
var_dump(reset($results));
class stdClass#45 (4) {
public $cid => string(36) "6ecdcaa4-a42d-4360-88a0-90131287f9ef"
public $external_id => string(6) "110268"
public $short_name => string(7) "KCTSDT4"
public $full_name => string(10) "KCTS World"
public $timezone => string(19) "America/Los_Angeles"
public $listings => array(20) { ... }
public $analog_channel => string(1) "9"
public $digital_channel => string(3) "9.4"
}
$today = new DateTime();
$results = $client->getListings($today, false, true);
var_dump($results[0]->listings[0]);
class stdClass#41 (25) {
[...]
public $images => array(19) {
[0] => class stdClass#33 (8) {
public $type => string(10) "image/jpeg"
public $image => string(84) "https://image.pbs.org/gracenote/pbsd.tmsimg.com/assets/p7879062_n183662_cc_v9_aa.jpg"
public $ratio => string(3) "3:4"
public $width => string(4) "1080"
public $height => string(4) "1440"
public $caption => string(10) "Ray Suarez"
public $updated_at => string(20) "2012-12-12T00:00:00Z"
public $external_profile => string(17) "Cast in Character"
}
[1] => class stdClass#34 (8) {
public $type => string(10) "image/jpeg"
public $image => string(84) "https://image.pbs.org/gracenote/pbsd.tmsimg.com/assets/p7879062_n191589_cc_v9_ab.jpg"
public $ratio => string(3) "3:4"
public $width => string(4) "1080"
public $height => string(4) "1440"
public $caption => string(10) "Gwen Ifill"
public $updated_at => string(20) "2013-09-04T21:02:00Z"
public $external_profile => string(17) "Cast in Character"
}
[...]
}
[...]
}
$results = $client->search('jamestown');
var_dump($results);
class stdClass#31 (2) {
public $program_results => array(2) { ... }
public $show_results => array(5) { ... }
}