<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Views From The Hill &#187; Zext</title>
	<atom:link href="http://dustint.com/archives/tag/zext/feed" rel="self" type="application/rss+xml" />
	<link>http://dustint.com</link>
	<description>Tales Of A (Former) SFU Computing Scientist</description>
	<lastBuildDate>Thu, 17 Jun 2010 20:14:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Translink Zend Framework API</title>
		<link>http://dustint.com/archives/66</link>
		<comments>http://dustint.com/archives/66#comments</comments>
		<pubDate>Wed, 16 Sep 2009 09:30:01 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zext]]></category>

		<guid isPermaLink="false">http://dustint.com/?p=66</guid>
		<description><![CDATA[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 &#8220;hidden&#8221; api that is used by the Iphone app to preform AJAX [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://translink.bc.ca" target="_blank">Translink</a> 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 <a href="http://www.mweisman.com/transit.html">write</a> about the &#8220;hidden&#8221; api that is used by the Iphone app to preform AJAX calls.<br />
<span id="more-66"></span></p>
<p>The Zend Framework based API that I have written duplicates the functionality described on Micheal&#8217;s page and exposes the API functionality to PHP applications.</p>
<p>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.</p>
<h1>Example Usage</h1>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$translink</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zext_Service_Translink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Get the route directions for the 135</span>
<span style="color: #000088;">$directions</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$translink</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRouteDirections</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'135'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Zend_Debug<span style="color: #339933;">::</span><span style="color: #004000;">dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$directions</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Get the east-bound stops for the 135</span>
<span style="color: #000088;">$stops</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$translink</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRouteStops</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'135'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'east'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Zend_Debug<span style="color: #339933;">::</span><span style="color: #004000;">dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$stops</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Get the details for an arbitrary stop</span>
Zend_Debug<span style="color: #339933;">::</span><span style="color: #004000;">dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$translink</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStopDetails</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">51845</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//get the latitude and longitude for a stop</span>
Zend_Debug<span style="color: #339933;">::</span><span style="color: #004000;">dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$translink</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStopLocation</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">51845</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//get the stops near a given latitude and longitude</span>
Zend_Debug<span style="color: #339933;">::</span><span style="color: #004000;">dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$translink</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLocationStops</span><span style="color: #009900;">&#40;</span><span style="color:#800080;">49.25344</span><span style="color: #339933;">,-</span><span style="color:#800080;">123.167895</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h1>Download &amp; Install</h1>
<p>Download the following file:<br />
<a href="http://dustint.com/wp-content/uploads/2009/08/Zext_Service_Translink.zip">Zext_Service_Translink</a><br />
Add it to your library path (same folder that Zend of the Zend framework resides in) if you have autoloading enabled.</p>
<p>I will try to respond to any problems in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://dustint.com/archives/66/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BC Lottery Corporation API</title>
		<link>http://dustint.com/archives/93</link>
		<comments>http://dustint.com/archives/93#comments</comments>
		<pubDate>Wed, 02 Sep 2009 09:30:05 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zext]]></category>

		<guid isPermaLink="false">http://dustint.com/?p=93</guid>
		<description><![CDATA[The British Columbia Lottery Corporation has an unpublished API that they use to pull data down for the flash application on their home page. The Zext PHP API exposes functionality to query the most resent winning numbers from the BCLC website, as well as retrieve current jackpot estimates for the main lotteries in this province. [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.bclc.com/">British Columbia Lottery Corporation</a> has an unpublished API that they use to pull data down for the flash application on their home page. The Zext PHP API exposes functionality to query the most resent winning numbers from the BCLC website, as well as retrieve current jackpot estimates for the main lotteries in this province.<br />
<span id="more-93"></span><br />
Again, as with most of the API&#8217;s I have been publishing lately, this API relies on undocumented and unsupported functionality which may break or become unavailable at any time. Furthermore, there are likely licensing issues involved with unauthorized use of BCLC data, so proceed with caution if you plan on using this API in a production app.</p>
<h1>Example Usage</h1>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$bclc</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zext_Service_BCLC<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Get the results of the latest 649 results</span>
<span style="color: #000088;">$bclc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get649Results</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//get the estimated jackpot size for the latest 649 results</span>
<span style="color: #000088;">$bclc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get649Estimate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Get the 649 Extra numbers for the latest draw</span>
<span style="color: #000088;">$bclc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get649ExtraResults</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>There are many other functions that the API exposes. Take a look through the source to view them all.</p>
<h1>Download &#038; Install</h1>
<p>Download the following file:<br />
<a href='http://dustint.com/wp-content/uploads/2009/08/Zext_Service_BCLC.zip'>Zext_Service_BCLC</a><br />
Add it to your library path (same folder that Zend of the Zend framework resides in) if you have autoloading enabled.</p>
<p>I will try to respond to any problems in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://dustint.com/archives/93/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
