Skip to content

Instantly share code, notes, and snippets.

@raytiley
Created June 15, 2013 14:30
Show Gist options
  • Save raytiley/5788330 to your computer and use it in GitHub Desktop.
Save raytiley/5788330 to your computer and use it in GitHub Desktop.
<?php
//Configure Script
$server = "http://50.200.83.14/"; //include trailing backslash
$channelID = 3; //Cablecast Channel ID
$displayDays = 0; //Number of Days to Display
$showDetailsURL = "/?page_id=540&"; // Must end with a '?' or '&'
date_default_timezone_set('America/New_York');
//End Configure
//SOAP Client Setup
$server= $server."/CablecastWS/CablecastWS.asmx?WSDL";
$client = new SoapClient($server);
//End SOAP Client Setup
//Create search dates
$dateString = date("Y-m-d")."T00:00:00";
$endDate = date("Y-m-d", strtotime($dateString) + ($displayDays * 24 * 60 * 60))."T07:00:00";
//Search the schedule
$result = $client->GetScheduleInformation(array(
'ChannelID' => $channelID,
'FromDate' => $dateString,
'ToDate' => $endDate,
'restrictToShowID' => 0));
//Pull out schedule
$schedule = $result->GetScheduleInformationResult->ScheduleInfo;
//If Scheudule is NULL there is nothing left to do.
if($scheudle == NULL) {
echo "There is nothing scheduled for this day";
} else {
//Make sure schedule is an array.
$schedule = is_array($schedule) ?
$schedule :
array($schedule);
//Loop through runs creating a table
$startDay = "";
echo "<table>\n \n";
foreach($schedule as $run) {
$day = date("Y-m-d", strtotime($run->StartTime));
if($day != $startDay) {
echo "<tr><th colspan=\"2\" id=\"scheduledate\">".date("l F jS, Y", strtotime($day))."</th></tr>\n";
$startDay = $day;
}
echo "<tr><td id=\"scheduletime\"><NOBR>".date("g:i a", strtotime($run->StartTime))."</NOBR></td><td><a href=\"".$showDetailsURL."ShowID=".$run->ShowID."\">".$run->ShowTitle."</a></td></tr>\n";
$count++;
}
echo "</table>\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment