<?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>Zend Framework Blog &#187; Zend_Service_Twitter</title>
	<atom:link href="http://blog.richardknop.com/tag/zend_service_twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.richardknop.com</link>
	<description>Zend Framework, PHP, Django, Python, SQL, MySQL, PostgreSQL, Oracle, PL/SQL, data model patterns, OOP, design patterns, JavaScript, jQuery, HTML, XHTML, CSS, XML, web services &#38; APIs, Security, E-commerce and much more</description>
	<lastBuildDate>Sat, 04 Feb 2012 19:47:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Zend_Service_Twitter</title>
		<link>http://blog.richardknop.com/2009/05/zend_service_twitter/</link>
		<comments>http://blog.richardknop.com/2009/05/zend_service_twitter/#comments</comments>
		<pubDate>Sun, 31 May 2009 20:43:43 +0000</pubDate>
		<dc:creator>Richard Knop</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Twitter API]]></category>
		<category><![CDATA[Zend_Service_Twitter]]></category>

		<guid isPermaLink="false">http://blog.richardknop.com/?p=261</guid>
		<description><![CDATA[In the previous post (Working with Twitter API in PHP) I wrote about how to use cURL to communicate with the Twitter API. There is an easier way when you&#8217;re using Zend Framework though &#8211; Zend_Service_Twitter. Bellow is just a simple example usage. In the controller: $twitter = new Zend_Service_Twitter&#40;&#39;your_username&#39;, &#39;your_password&#39;&#41;; // return last 20 [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous post (<a href="http://blog.richardknop.com/2009/05/working-with-twitter-api-in-php/">Working with Twitter API in PHP</a>) I wrote about how to use cURL to communicate with the Twitter API. There is an easier way when you&#8217;re using Zend Framework though &#8211; <a href="http://framework.zend.com/manual/en/zend.service.twitter.html">Zend_Service_Twitter</a>. Bellow is just a simple example usage.</p>
<p>In the controller:</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="re1">$twitter</span> <span class="sy0">=</span> <span class="kw2">new</span> Zend_Service_Twitter<span class="br0">&#40;</span><span class="st0">&#39;your_username&#39;</span><span class="sy0">,</span> <span class="st0">&#39;your_password&#39;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// return last 20 statuses from a user</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$this</span><span class="sy0">-&gt;</span><span class="me1">view</span><span class="sy0">-&gt;</span><span class="me1">xml</span> <span class="sy0">=</span> <span class="re1">$twitter</span><span class="sy0">-&gt;</span><span class="me1">status</span><span class="sy0">-&gt;</span><span class="me1">userTimeline</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
<p>In the view (to print the last user&#8217;s status):</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>p<span class="sy0">&gt;&lt;</span>?php <span class="kw3">echo</span> <span class="re1">$this</span><span class="sy0">-&gt;</span><span class="me1">escape</span><span class="br0">&#40;</span><span class="re1">$this</span><span class="sy0">-&gt;</span><span class="me1">xml</span><span class="sy0">-&gt;</span><span class="me1">status</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">-&gt;</span><span class="me1">text</span><span class="br0">&#41;</span><span class="sy0">;</span> ?<span class="sy0">&gt;&lt;/</span>p<span class="sy0">&gt;</span></div>
</li>
</ol>
</div>
<p>For other availale methods read the whole documentation. Also don&#8217;t forget to take a look at other APIs the Zend Framework can work with natively (including Akismet, Amazon, Del.icio.us, Flickr, Yahoo and others) <a href="http://framework.zend.com/manual/en/zend.service.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.richardknop.com/2009/05/zend_service_twitter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

