<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -23,6 +23,7 @@ class EpiTwitter extends EpiOAuth
   protected $searchUrl      = 'http://search.twitter.com';
   protected $userAgent      = 'EpiTwitter (http://github.com/jmathai/twitter-async/tree/)';
   protected $apiVersion     = '1';
+  protected $isAsynchronous = false;
 
   /* OAuth methods */
   public function delete($endpoint, $params = null)
@@ -61,6 +62,11 @@ class EpiTwitter extends EpiOAuth
     $this-&gt;apiVersion = $version;
   }
 
+  public function useAsynchronous($async = true)
+  {
+    $this-&gt;isAsynchronous = (bool)$async;
+  }
+
   public function __construct($consumerKey = null, $consumerSecret = null, $oauthToken = null, $oauthTokenSecret = null)
   {
     parent::__construct($consumerKey, $consumerSecret, self::EPITWITTER_SIGNATURE_METHOD);
@@ -119,7 +125,11 @@ class EpiTwitter extends EpiOAuth
     }
 
     $url = $this-&gt;getUrl($this-&gt;getApiUrl($endpoint));
-    return new EpiTwitterJson(call_user_func(array($this, 'httpRequest'), $method, $url, $params, $isMultipart), $this-&gt;debug);
+    $resp= new EpiTwitterJson(call_user_func(array($this, 'httpRequest'), $method, $url, $params, $isMultipart), $this-&gt;debug);
+    if(!$this-&gt;isAsynchronous)
+      $resp-&gt;responseText;
+
+    return $resp;
   }
 
   private function request_basic($method, $endpoint, $params = null, $username = null, $password = null)
@@ -137,7 +147,11 @@ class EpiTwitter extends EpiOAuth
     if(!empty($username) &amp;&amp; !empty($password))
       curl_setopt($ch, CURLOPT_USERPWD, &quot;{$username}:{$password}&quot;);
 
-    return new EpiTwitterJson(EpiCurl::getInstance()-&gt;addCurl($ch), $this-&gt;debug);
+    $resp = new EpiTwitterJson(EpiCurl::getInstance()-&gt;addCurl($ch), $this-&gt;debug);
+    if(!$this-&gt;isAsynchronous)
+      $resp-&gt;responseText;
+
+    return $resp;
   }
 }
 
@@ -229,12 +243,7 @@ class EpiTwitterException extends EpiException
 {
   public static function raise($response, $debug)
   {
-    $message = array();
-    $message['text'] = 'An exception occurred in EpiTwitter';
-    $message['response'] = $response-&gt;data;
-    if($debug === true)
-      $message['headers'] = json_encode($response-&gt;headers);
-    $message = json_encode($message);
+    $message = $response-&gt;data;
  
     switch($response-&gt;code)
     {</diff>
      <filename>EpiTwitter.php</filename>
    </modified>
    <modified>
      <diff>@@ -23,34 +23,34 @@ class EpiTwitterTest extends PHPUnit_Framework_TestCase
     $this-&gt;twitterPassword = 'jmathai_test';
   }
 
-//function testGetAuthenticateurl()
-//{
-//  $aUrl = $this-&gt;twitterObjUnAuth-&gt;getAuthenticateUrl();
-//  $this-&gt;assertTrue(strstr($aUrl, 'http://twitter.com/oauth/authenticate') !== false, 'Authenticate url did not contain member definition from EpiTwitter class');
-
-//  $aUrl = $this-&gt;twitterObjUnAuth-&gt;getAuthenticateUrl(null, array('force_login'=&gt;'true'));
-//  $this-&gt;assertTrue(strstr($aUrl, 'http://twitter.com/oauth/authenticate') !== false, 'Authenticate url did not contain member definition from EpiTwitter class');
-//  $this-&gt;assertTrue(strstr($aUrl, 'force_login=true') !== false, 'Authenticate url did not contain member definition from EpiTwitter class');
-//}
-
-//function testGetAuthorizeUrl()
-//{
-//  $aUrl = $this-&gt;twitterObjUnAuth-&gt;getAuthorizeUrl($this-&gt;token);
-//  $this-&gt;assertTrue(strstr($aUrl, 'http://twitter.com/oauth/authorize') !== false, 'Authorize url did not contain member definition from EpiTwitter class');
-//}
-
-//function testGetRequestToken()
-//{
-//  $resp = $this-&gt;twitterObjUnAuth-&gt;getRequestToken();
-//  $this-&gt;assertTrue(strlen($resp-&gt;oauth_token) &gt; 0, &quot;oauth_token is longer than 0&quot;);
-//  $this-&gt;assertTrue(strlen($resp-&gt;oauth_token_secret) &gt; 0, &quot;oauth_token_secret is longer than 0&quot;);
-//  $this-&gt;assertTrue(strlen($resp-&gt;oauth_callback_confirmed) == 0, &quot;oauth_callback is not = true&quot;);
-
-//  $resp = $this-&gt;twitterObjUnAuth-&gt;getRequestToken(array('oauth_callback' =&gt; urlencode('http://www.yahoo.com')));
-//  $this-&gt;assertTrue(strlen($resp-&gt;oauth_token) &gt; 0, &quot;oauth_token is longer than 0&quot;);
-//  $this-&gt;assertTrue(strlen($resp-&gt;oauth_token_secret) &gt; 0, &quot;oauth_token_secret is longer than 0&quot;);
-//  $this-&gt;assertTrue($resp-&gt;oauth_callback_confirmed == 'true', &quot;oauth_callback is not = true&quot;);
-//}
+  function testGetAuthenticateurl()
+  {
+    $aUrl = $this-&gt;twitterObjUnAuth-&gt;getAuthenticateUrl();
+    $this-&gt;assertTrue(strstr($aUrl, 'http://twitter.com/oauth/authenticate') !== false, 'Authenticate url did not contain member definition from EpiTwitter class');
+
+    $aUrl = $this-&gt;twitterObjUnAuth-&gt;getAuthenticateUrl(null, array('force_login'=&gt;'true'));
+    $this-&gt;assertTrue(strstr($aUrl, 'http://twitter.com/oauth/authenticate') !== false, 'Authenticate url did not contain member definition from EpiTwitter class');
+    $this-&gt;assertTrue(strstr($aUrl, 'force_login=true') !== false, 'Authenticate url did not contain member definition from EpiTwitter class');
+  }
+
+  function testGetAuthorizeUrl()
+  {
+    $aUrl = $this-&gt;twitterObjUnAuth-&gt;getAuthorizeUrl($this-&gt;token);
+    $this-&gt;assertTrue(strstr($aUrl, 'http://twitter.com/oauth/authorize') !== false, 'Authorize url did not contain member definition from EpiTwitter class');
+  }
+
+  function testGetRequestToken()
+  {
+    $resp = $this-&gt;twitterObjUnAuth-&gt;getRequestToken();
+    $this-&gt;assertTrue(strlen($resp-&gt;oauth_token) &gt; 0, &quot;oauth_token is longer than 0&quot;);
+    $this-&gt;assertTrue(strlen($resp-&gt;oauth_token_secret) &gt; 0, &quot;oauth_token_secret is longer than 0&quot;);
+    $this-&gt;assertTrue(strlen($resp-&gt;oauth_callback_confirmed) == 0, &quot;oauth_callback is not = true&quot;);
+
+    $resp = $this-&gt;twitterObjUnAuth-&gt;getRequestToken(array('oauth_callback' =&gt; urlencode('http://www.yahoo.com')));
+    $this-&gt;assertTrue(strlen($resp-&gt;oauth_token) &gt; 0, &quot;oauth_token is longer than 0&quot;);
+    $this-&gt;assertTrue(strlen($resp-&gt;oauth_token_secret) &gt; 0, &quot;oauth_token_secret is longer than 0&quot;);
+    $this-&gt;assertTrue($resp-&gt;oauth_callback_confirmed == 'true', &quot;oauth_callback is not = true&quot;);
+  }
 
   function testBooleanResponse()
   {
@@ -277,41 +277,16 @@ class EpiTwitterTest extends PHPUnit_Framework_TestCase
     // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
     $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
 
-    $file = dirname(__FILE__) . '/avatar_test_image.png';
-    $resp = $this-&gt;twitterObj-&gt;post('/account/update_profile_image.json', array('@image' =&gt; &quot;@{$file}&quot;));
-    // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
-    $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
-
     // __call
     $file = dirname(__FILE__) . '/avatar_test_image.jpg';
     $resp = $this-&gt;twitterObj-&gt;post_accountUpdate_profile_image(array('@image' =&gt; &quot;@{$file}&quot;));
     // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
     $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
-
-    $file = dirname(__FILE__) . '/avatar_test_image.png';
-    $resp = $this-&gt;twitterObj-&gt;post_accountUpdate_profile_image(array('@image' =&gt; &quot;@{$file}&quot;));
-    // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
-    $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
   }
 
   function testUpdateBackground()
   {
     $file = dirname(__FILE__) . '/avatar_test_image.jpg';
-    $resp = $this-&gt;twitterObj-&gt;post('/account/update_profile_background_image.json', array('@image' =&gt; &quot;@{$file}&quot;));
-    // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
-    $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
-
-    $file = dirname(__FILE__) . '/avatar_test_image.jpg';
-    $resp = $this-&gt;twitterObj-&gt;post('/account/update_profile_background_image.json', array('@image' =&gt; &quot;@{$file}&quot;, 'tile' =&gt; 'true'));
-    // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
-    $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
-
-    $file = dirname(__FILE__) . '/avatar_test_image.png';
-    $resp = $this-&gt;twitterObj-&gt;post('/account/update_profile_background_image.json', array('@image' =&gt; &quot;@{$file}&quot;));
-    // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
-    $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
-
-    $file = dirname(__FILE__) . '/avatar_test_image.png';
     $resp = $this-&gt;twitterObj-&gt;post('/account/update_profile_background_image.json', array('@image' =&gt; &quot;@{$file}&quot;, 'tile' =&gt; 'true'));
     // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
     $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
@@ -321,21 +296,6 @@ class EpiTwitterTest extends PHPUnit_Framework_TestCase
     $resp = $this-&gt;twitterObj-&gt;post_accountUpdate_profile_background_image(array('@image' =&gt; &quot;@{$file}&quot;));
     // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
     $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
-
-    $file = dirname(__FILE__) . '/avatar_test_image.jpg';
-    $resp = $this-&gt;twitterObj-&gt;post_accountUpdate_profile_background_image(array('@image' =&gt; &quot;@{$file}&quot;, 'tile' =&gt; 'true'));
-    // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
-    $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
-
-    $file = dirname(__FILE__) . '/avatar_test_image.png';
-    $resp = $this-&gt;twitterObj-&gt;post_accountUpdate_profile_background_image(array('@image' =&gt; &quot;@{$file}&quot;));
-    // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
-    $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
-
-    $file = dirname(__FILE__) . '/avatar_test_image.png';
-    $resp = $this-&gt;twitterObj-&gt;post_accountUpdate_profile_background_image(array('@image' =&gt; &quot;@{$file}&quot;, 'tile' =&gt; 'true'));
-    // api seems to be a bit behind and doesn't respond with the new image url - use code instead for now
-    $this-&gt;assertEquals($resp-&gt;code, 200, 'Response code was not 200');
   }
 
   function testCreateFriendship()</diff>
      <filename>tests/EpiTwitterTest.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c653259a0c8448d92ba27d4d431b53ccf3dcf0a8</id>
    </parent>
  </parents>
  <author>
    <name>Jaisen Mathai</name>
    <email>jaisen@jmathai.com</email>
  </author>
  <url>http://github.com/jmathai/twitter-async/commit/f9531a3130ff89bd61d9f4b394f318fb669febfd</url>
  <id>f9531a3130ff89bd61d9f4b394f318fb669febfd</id>
  <committed-date>2009-11-05T23:27:44-08:00</committed-date>
  <authored-date>2009-11-05T23:27:44-08:00</authored-date>
  <message>Final commit for version 2 before merging into master.</message>
  <tree>bae6b923ae0afcd9604bdfa089f03c61a13e3bf6</tree>
  <committer>
    <name>Jaisen Mathai</name>
    <email>jaisen@jmathai.com</email>
  </committer>
</commit>
