Explorar el Código

Updated docs for Zend_Service_Twitter's OAuth dependency

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22628 44c647ce-9c0f-0410-b52a-842ac1e357ba
padraic hace 15 años
padre
commit
e9755b696b

+ 172 - 50
documentation/manual/en/module_specs/Zend_Service_Twitter.xml

@@ -11,13 +11,13 @@
             <ulink url="http://apiwiki.twitter.com/Twitter-API-Documentation">Twitter
             <ulink url="http://apiwiki.twitter.com/Twitter-API-Documentation">Twitter
             <acronym>REST</acronym> <acronym>API</acronym></ulink>.
             <acronym>REST</acronym> <acronym>API</acronym></ulink>.
             <classname>Zend_Service_Twitter</classname> allows you to query the public timeline. If
             <classname>Zend_Service_Twitter</classname> allows you to query the public timeline. If
-            you provide a username and password for Twitter, it will allow you to get and update
+            you provide a username and OAuth details for Twitter, it will allow you to get and update
             your status, reply to friends, direct message friends, mark tweets as favorite, and
             your status, reply to friends, direct message friends, mark tweets as favorite, and
             much more.
             much more.
         </para>
         </para>
 
 
         <para>
         <para>
-            <classname>Zend_Service_Twitter</classname> is implementing a <acronym>REST</acronym>
+            <classname>Zend_Service_Twitter</classname> implements a <acronym>REST</acronym>
             service, and all methods return an instance of
             service, and all methods return an instance of
             <classname>Zend_Rest_Client_Result</classname>.
             <classname>Zend_Rest_Client_Result</classname>.
         </para>
         </para>
@@ -83,40 +83,81 @@
 
 
         <para>
         <para>
             With the exception of fetching the public timeline,
             With the exception of fetching the public timeline,
-            <classname>Zend_Service_Twitter</classname> requires authentication to work.
-            Twitter currently uses
-            <ulink url="http://en.wikipedia.org/wiki/Basic_authentication_scheme">HTTP Basic
-            Authentication</ulink>. You can pass in your username or registered email along with
-            your password for Twitter to login.
+            <classname>Zend_Service_Twitter</classname> requires authentication as a valid
+            user. This is achieved using the OAuth authentication protocol. OAuth is
+            the only supported authentication mode for Twitter as of August 2010. The OAuth
+            implementation used by <classname>Zend_Service_Twitter</classname> is
+            <classname>Zend_Oauth</classname>.
         </para>
         </para>
 
 
         <example id="zend.service.twitter.authentication.example">
         <example id="zend.service.twitter.authentication.example">
             <title>Creating the Twitter Class</title>
             <title>Creating the Twitter Class</title>
 
 
             <para>
             <para>
-                The following code sample is how you create the Twitter service, pass in your
-                username and password, and verify that they are correct.
+                <classname>Zend_Service_Twitter</classname> must authorize itself, on behalf of a user, before use with the
+                Twitter API (except for public timeline). This must be accomplished using OAuth since
+                Twitter has disabled it's basic HTTP authentication as of August 2010.
             </para>
             </para>
-
-            <programlisting language="php"><![CDATA[
-$twitter = new Zend_Service_Twitter('myusername', 'mysecretpassword');
-
-// verify your credentials with Twitter
-$response = $twitter->account->verifyCredentials();
-]]></programlisting>
-
+            
             <para>
             <para>
-                You can also pass in an array that contains the username and password as the
-                first argument.
+                There are two options to establishing authorization. The first is to implement the
+                workflow of <classname>Zend_Oauth</classname> via <classname>Zend_Service_Twitter</classname>
+                which proxies to an internal <classname>Zend_Oauth_Consumer</classname> object. Please refer to
+                the <classname>Zend_Oauth</classname> documentation for a full example of this
+                workflow - you can call all documented <classname>Zend_Oauth_Consumer</classname> methods
+                on <classname>Zend_Service_Twitter</classname> including constructor options. You may also
+                use <classname>Zend_Oauth</classname> directly and only pass the resulting access
+                token into <classname>Zend_Service_Twitter</classname>. This is the normal workflow
+                once you have established a reusable access token for a particular Twitter user. The resulting OAuth
+                access token should be stored to a database for future use (otherwise you will need to
+                authorize for every new instance of <classname>Zend_Service_Twitter</classname>). Bear in mind
+                that authorization via OAuth results in your user being redirected to Twitter to give their
+                consent to the requested authorization (this is not repeated for stored access tokens). This will
+                require additional work (i.e. redirecting users and hosting a callback URL) over the previous
+                HTTP authentication mechanism where a user just
+                needed to allow applications to store their username and password.
             </para>
             </para>
+            
+            <note>
+                <para>
+                    In order to authenticate with Twitter, ALL applications MUST be registered with
+                    Twitter in order to receive a Consumer Key and Consumer Secret to be used when
+                    authenticating with OAuth. This can not be reused across multiple applications - 
+                    you must register each new application separately. Twitter access tokens have
+                    no expiry date, so storing them to a database is advised (they can, of course,
+                    be refreshed simply be repeating the OAuth authorization process). This can only
+                    be done while interacting with the user associated with that access token.
+                </para>
+            </note>
+            
+            <para>The following example demonstrates setting up <classname>Zend_Service_Twitter</classname>
+            which is given an already established OAuth access token. Please refer to the <classname>Zend_Oauth</classname>
+            documentation to understand the workflow involved. The access token is a serializable object, so you may
+            store the serialized object to a database, and unserialize it at retrieval time before passing the objects
+            into <classname>Zend_Service_Twitter</classname>. The <classname>Zend_Oauth</classname> documentation
+            demonstrates the workflow and objects involved.</para>
 
 
             <programlisting language="php"><![CDATA[
             <programlisting language="php"><![CDATA[
-$userInfo   = array('username' => 'foo', 'password' => 'bar');
-$twitter    = new Zend_Service_Twitter($userInfo);
-
-// verify your credentials with Twitter
+/**
+ * We assume $serializedToken is the serialized token retrieved from a database
+ * or even $_SESSION (if following the simple Zend_Oauth documented example)
+ */
+$token = unserialize($serializedToken);            
+
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
+
+// verify user's credentials with Twitter
 $response = $twitter->account->verifyCredentials();
 $response = $twitter->account->verifyCredentials();
 ]]></programlisting>
 ]]></programlisting>
+
+    <note>
+        <para>The previous pre-OAuth version of <classname>Zend_Service_Twitter</classname> allowed
+        passing in a username as the first parameter rather than within an array. This is no longer supported.</para>
+    </note>
+
         </example>
         </example>
     </sect2>
     </sect2>
 
 
@@ -134,7 +175,10 @@ $response = $twitter->account->verifyCredentials();
                     <title>Verifying credentials</title>
                     <title>Verifying credentials</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->account->verifyCredentials();
 $response   = $twitter->account->verifyCredentials();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -150,7 +194,10 @@ $response   = $twitter->account->verifyCredentials();
                     <title>Sessions ending</title>
                     <title>Sessions ending</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->account->endSession();
 $response   = $twitter->account->endSession();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -167,7 +214,10 @@ $response   = $twitter->account->endSession();
                     <title>Rating limit status</title>
                     <title>Rating limit status</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->account->rateLimitStatus();
 $response   = $twitter->account->rateLimitStatus();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -190,7 +240,10 @@ $response   = $twitter->account->rateLimitStatus();
                     <title>Retrieving public timeline</title>
                     <title>Retrieving public timeline</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->status->publicTimeline();
 $response   = $twitter->status->publicTimeline();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -206,7 +259,10 @@ $response   = $twitter->status->publicTimeline();
                     <title>Retrieving friends timeline</title>
                     <title>Retrieving friends timeline</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->status->friendsTimeline();
 $response   = $twitter->status->friendsTimeline();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -242,7 +298,10 @@ $response   = $twitter->status->friendsTimeline();
                     <title>Retrieving user timeline</title>
                     <title>Retrieving user timeline</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->status->userTimeline();
 $response   = $twitter->status->userTimeline();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -292,7 +351,10 @@ $response   = $twitter->status->userTimeline();
                     <title>Showing user status</title>
                     <title>Showing user status</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->status->show(1234);
 $response   = $twitter->status->show(1234);
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -309,7 +371,10 @@ $response   = $twitter->status->show(1234);
                     <title>Updating user status</title>
                     <title>Updating user status</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->status->update('My Great Tweet');
 $response   = $twitter->status->update('My Great Tweet');
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -339,7 +404,10 @@ $response   = $twitter->status->update('My Great Tweet');
                     <title>Showing user replies</title>
                     <title>Showing user replies</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->status->replies();
 $response   = $twitter->status->replies();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -381,7 +449,10 @@ $response   = $twitter->status->replies();
                     <title>Deleting user status</title>
                     <title>Deleting user status</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->status->destroy(12345);
 $response   = $twitter->status->destroy(12345);
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -403,7 +474,10 @@ $response   = $twitter->status->destroy(12345);
                     <title>Retrieving user friends</title>
                     <title>Retrieving user friends</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->user->friends();
 $response   = $twitter->user->friends();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -446,7 +520,10 @@ $response   = $twitter->user->friends();
                     <title>Retrieving user followers</title>
                     <title>Retrieving user followers</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->user->followers();
 $response   = $twitter->user->followers();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -483,7 +560,10 @@ $response   = $twitter->user->followers();
                     <title>Showing user informations</title>
                     <title>Showing user informations</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->user->show('myfriend');
 $response   = $twitter->user->show('myfriend');
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -505,7 +585,10 @@ $response   = $twitter->user->show('myfriend');
                     <title>Retrieving recent direct messages received</title>
                     <title>Retrieving recent direct messages received</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->directMessage->messages();
 $response   = $twitter->directMessage->messages();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -548,7 +631,10 @@ $response   = $twitter->directMessage->messages();
                     <title>Retrieving recent direct messages sent</title>
                     <title>Retrieving recent direct messages sent</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->directMessage->sent();
 $response   = $twitter->directMessage->sent();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -591,7 +677,10 @@ $response   = $twitter->directMessage->sent();
                     <title>Sending direct message</title>
                     <title>Sending direct message</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->directMessage->new('myfriend', 'mymessage');
 $response   = $twitter->directMessage->new('myfriend', 'mymessage');
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -608,7 +697,10 @@ $response   = $twitter->directMessage->new('myfriend', 'mymessage');
                     <title>Deleting direct message</title>
                     <title>Deleting direct message</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->directMessage->destroy(123548);
 $response   = $twitter->directMessage->destroy(123548);
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -630,7 +722,10 @@ $response   = $twitter->directMessage->destroy(123548);
                     <title>Creating friend</title>
                     <title>Creating friend</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->friendship->create('mynewfriend');
 $response   = $twitter->friendship->create('mynewfriend');
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -646,7 +741,10 @@ $response   = $twitter->friendship->create('mynewfriend');
                     <title>Deleting friend</title>
                     <title>Deleting friend</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->friendship->destroy('myoldfriend');
 $response   = $twitter->friendship->destroy('myoldfriend');
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -662,7 +760,10 @@ $response   = $twitter->friendship->destroy('myoldfriend');
                     <title>Checking friend existence</title>
                     <title>Checking friend existence</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->friendship->exists('myfriend');
 $response   = $twitter->friendship->exists('myfriend');
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -685,7 +786,10 @@ $response   = $twitter->friendship->exists('myfriend');
                     <title>Retrieving favorites</title>
                     <title>Retrieving favorites</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->favorite->favorites();
 $response   = $twitter->favorite->favorites();
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -721,7 +825,10 @@ $response   = $twitter->favorite->favorites();
                     <title>Creating favorites</title>
                     <title>Creating favorites</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->favorite->create(12351);
 $response   = $twitter->favorite->create(12351);
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -737,7 +844,10 @@ $response   = $twitter->favorite->create(12351);
                     <title>Deleting favorites</title>
                     <title>Deleting favorites</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->favorite->destroy(12351);
 $response   = $twitter->favorite->destroy(12351);
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -760,7 +870,10 @@ $response   = $twitter->favorite->destroy(12351);
                     <title>Checking if block exists</title>
                     <title>Checking if block exists</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 
 
 // returns true or false
 // returns true or false
 $response = $twitter->block->exists('blockeduser');
 $response = $twitter->block->exists('blockeduser');
@@ -798,7 +911,10 @@ $response2 = $twitter->block->exists('blockeduser', true);
                     <title>Blocking a user</title>
                     <title>Blocking a user</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->block->create('usertoblock);
 $response   = $twitter->block->create('usertoblock);
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -815,7 +931,10 @@ $response   = $twitter->block->create('usertoblock);
                     <title>Removing a block</title>
                     <title>Removing a block</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter    = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 $response   = $twitter->block->destroy('blockeduser');
 $response   = $twitter->block->destroy('blockeduser');
 ]]></programlisting>
 ]]></programlisting>
                 </example>
                 </example>
@@ -831,7 +950,10 @@ $response   = $twitter->block->destroy('blockeduser');
                     <title>Who are you blocking</title>
                     <title>Who are you blocking</title>
 
 
                     <programlisting language="php"><![CDATA[
                     <programlisting language="php"><![CDATA[
-$twitter = new Zend_Service_Twitter('myusername', 'mysecretpassword');
+$twitter = new Zend_Service_Twitter(array(
+    'username' => 'johndoe',
+    'accessToken' => $token
+));
 
 
 // return the full user list from the first page
 // return the full user list from the first page
 $response = $twitter->block->blocking();
 $response = $twitter->block->blocking();

+ 1 - 1
library/Zend/Service/Twitter.php

@@ -128,7 +128,7 @@ class Zend_Service_Twitter extends Zend_Rest_Client
      * @param  array $options Optional options array
      * @param  array $options Optional options array
      * @return void
      * @return void
      */
      */
-    public function __construct(array $options = null, Zend_Oauth_Consumer $consumer = null)
+    public function __construct($options = null, Zend_Oauth_Consumer $consumer = null)
     {
     {
         $this->setUri('http://api.twitter.com');
         $this->setUri('http://api.twitter.com');
         if (!is_array($options)) $options = array();
         if (!is_array($options)) $options = array();