JSFiddle - React, Tailwind, and code Playground

by kanelbula

HTML

<p>In this tutorial I will show how to make a Twitter user timeline on a website using Zend Framework and HTML5.
</p>

<p>
    If you are not familiar with Zend and want to build a website using it I recommend the Rob Allen's <a href="http://akrabat.com/zend-framework-tutorial/">tutorial</a> and the framework's <a href="http://framework.zend.com/manual/">documentation</a>.
</p>
  
<p>
    Part of the Zend Framework, <strong>Zend_Service_Twitter</strong> component provides a client for the Twitter REST API. <strong>Zend_Service_Twitter</strong> requires authentication as a valid user using the OAuth authentication protocol. The OAuth implementation used by <strong>Zend_Service_Twitter</strong> is <strong>Zend_Oauth</strong> component. In this tutorial I will request my own Twitter timeline data so I will use <strong>Zend_Oauth</strong> directly to create access token and pass it into <strong>Zend_Service_Twitter</strong> (no need to redirect users to Twitter to give their consent to the requested authorization).
</p>

<p>
    In order to authenticate with Twitter and sign requests with your own Twitter account one need to register a new Twitter application on <a href="https://dev.twitter.com/apps">https://dev.twitter.com/apps</a> site and obtain "access token" and "access token secret".</p>

<p>
    Next create <strong>Zend_Oauth_Token_Access</strong> object in the controller file:
</p>
<pre class="brush: php">
// Create OAuth token object
$token = new Zend_Oauth_Token_Access();

// Set token and secret
$token->setToken('twitter_access_token')->setTokenSecret('twitter_access_token_secret');
</pre>

<p>Having the token let's create <strong>Zend_Service_Twitter</strong> object and request data from Twitter API:</p>
<pre class="brush: php">
// Create options array
$options = array('accessToken' => $token);
            
// Create Twitter service object
$twitter = new Zend_Service_Twitter($options);

// Request data from Twitter (20 most recent statuses posted from the...

CSS

p { margin: 15px 0; }