Translink Zend Framework API

Translink is the local public transit provider for beautiful Vancouver, Canada. The system consists of Buses, Boats and Trains. Translink released an Iphone app some time ago that allows the lookup of bus information. Michael Weisman was kind enough to write about the “hidden” api that is used by the Iphone app to preform AJAX calls.

The Zend Framework based API that I have written duplicates the functionality described on Micheal’s page and exposes the API functionality to PHP applications.

Please keep in mind that as this is an unofficial API, Translink may not want their data being used without their permission. Please contact Translink before making use of this API on a production site.

Example Usage

$translink = new Zext_Service_Translink();
//Get the route directions for the 135
$directions = $translink->getRouteDirections('135');
//Get the east-bound stops for the 135
$stops = $translink->getRouteStops('135', 'east');
//Get the details for an arbitrary stop
//get the latitude and longitude for a stop
//get the stops near a given latitude and longitude

Download & Install

Download the following file:
Add it to your library path (same folder that Zend of the Zend framework resides in) if you have autoloading enabled.

I will try to respond to any problems in the comments.

, , ,

  1. No comments yet.
(will not be published)