Behavior, Content, Money – 3 Things you should never give away for free!!!

BCmoney MobileTV

Parser for XMLTV format and SchedulesDirect data

Posted by bcmoney on September 25, 2011 in JavaScript, PHP, Web Services, XML with 2 Comments

No Gravatar

Image via Wikipedia

For a long time now, I’ve been a paying customer of SchedulesDirect, and by that token their parent company Zap2it (now a Tribune Media Services company).

Recently, I’ve started publishing my own personal Electronic Programming Guide (EPG) here on BCmoney MobileTV in an accessible format:

One of the secondary goals of my MobileTV project has always been to be able to provide all XMLTV users a venue to easily access and conveniently plan/schedule their TV viewing via the web, on a variety devices (i.e. mobiles/tablets/desktop computers).

Soon I’ll be adding in a User Management feature that allows you to signup for SchedulesDirect and synch your account through BC$, and most importantly, protect your EPG and viewing data by your username and password (this is required to meet the SchedulesDirect usage terms and privacy policy).

I found that GET requests are not supported so technically the Tribune Web Service must still be following the SOAP 1.1 not SOAP 1.2 standard which specifies both GET and POST are acceptable as long as the SOAP request enveloppe is passed via URL.
Since that is not supported, you have to use POST and it also has to have the BASIC authentication information included in the header in the exact pattern:

Authorization: BASIC xxxxxxxxxxxxxxxxxxxxxxxxx


xxxxxxxxxxxxxxxxxxxx = base64encoded(username:password)

Don’t forget the semicolon as a string in between the username and password (like I did at first)!

Before any programming, try debugging using a SOAP tool… it DEFINITELY helps save sanitiy. I got it working using SOAP UI:
You need to do the following in SOAP UI:

  • File –> New SoapUI Project
  • Name it “SchedulesDirect” or something the like…
  • Paste in the WSDL location “”
  • Check “Create TestSuite” and “TestCase”
  • Expand the project, Under “xtvdBinding” there should be a “download” Web Service call stub, expand that and open Request 1
  • Click the little “Auth” tab at the bottom of the Request window (easy to miss… look down next to “Headers” and “Attachments” tabs)
  • Enter your SchedulesDirect username and password, then click the little green “Run” arrow at the top left of the Request window

With the initial testing out of the way as a “sanity check” on your SchedulesDirect account, you can now get started on the coding.

TMS Direct Download script

In the meantime, here’s a modified version of “tmsfetch.php” which was initially provided by SchedulesDirect as one of the official examples:


$start=gmdate("Y-m-dTH:i:sZ",time());         //today
$stop =gmdate("Y-m-dTH:i:sZ",time()+3600*24); //tomorrow (now + 24hrs)

$client = new SoapClient($wsdl_url, array('exceptions' => 0,
                                          'user_agent' => "php/".$_SERVER[SCRIPT_NAME],
                                          'login'      => strtolower($username),
                                          'password'   => $password));
$data = $client->download($start,$stop);



UPDATE (2012-05-07): the above was updated to include a Java-based XMLTV parser example as another alternative to PHP on the backend.


This script provides a basic way of downloading TV data in Tribune Media Services (TMS) format. It can even provide a translation into XMLTV format (which is slightly different than TMS, but conveys all the same data); however, it won’t help much with the display of the data on the front-end. For that, I would suggest looking into one of the approved applications for actually viewing your XMLTV listings in the familiar grid/list styled EPG. While most of the software there is designed to run on the desktop, I would highlight XSLTV for web-based applications. There is not yet a mobile-friendly XMLTV application but stay tuned for my new jQuery plugin (not yet available), which should hopefully be compatible with jQuery Mobile.