Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:jmathai/twitter-async

  • Loading branch information...
commit 6e0716000596cca374a1c884bebd89d3ebeb8002 2 parents 9fae500 + 0052c09
@jmathai authored
Showing with 61 additions and 0 deletions.
  1. +15 −0 EpiTwitter.php
  2. +1 −0  README
  3. +45 −0 simpleTest.php
View
15 EpiTwitter.php
@@ -258,6 +258,16 @@ public static function raise($response, $debug)
throw new EpiTwitterForbiddenException($message, $response->code);
case 404:
throw new EpiTwitterNotFoundException($message, $response->code);
+ case 406:
+ throw new EpiTwitterNotAcceptableException($message, $response->code);
+ case 420:
+ throw new EpiTwitterEnhanceYourCalmException($message, $response->code);
+ case 500:
+ throw new EpiTwitterInternalServerException($message, $response->code);
+ case 502:
+ throw new EpiTwitterBadGatewayException($message, $response->code);
+ case 503:
+ throw new EpiTwitterServiceUnavailableException($message, $response->code);
default:
throw new EpiTwitterException($message, $response->code);
}
@@ -267,3 +277,8 @@ class EpiTwitterBadRequestException extends EpiTwitterException{}
class EpiTwitterNotAuthorizedException extends EpiTwitterException{}
class EpiTwitterForbiddenException extends EpiTwitterException{}
class EpiTwitterNotFoundException extends EpiTwitterException{}
+class EpiTwitterNotAcceptableException extends EpiTwitterException{}
+class EpiTwitterEnhanceYourCalmException extends EpiTwitterException{}
+class EpiTwitterInternalServerException extends EpiTwitterException{}
+class EpiTwitterBadGatewayException extends EpiTwitterException{}
+class EpiTwitterServiceUnavailableException extends EpiTwitterException{}
View
1  README
@@ -13,6 +13,7 @@ Documentation:
Blogs
* http://www.jaisenmathai.com/blog/2009/04/30/letting-your-users-sign-in-with-twitter-with-oauth/
* http://www.jaisenmathai.com/blog/2009/03/31/how-to-quickly-integrate-with-twitters-oauth-api-using-php/
+ * http://www.1stwebdesigner.com/tutorials/twitter-app-oauth-php/
Live Examples
* http://www.jaisenmathai.com/sign_in_with_twitter/start.php
View
45 simpleTest.php
@@ -0,0 +1,45 @@
+<?php
+include 'EpiCurl.php';
+include 'EpiOAuth.php';
+include 'EpiTwitter.php';
+$consumer_key = 'jdv3dsDhsYuJRlZFSuI2fg';
+$consumer_secret = 'NNXamBsBFG8PnEmacYs0uCtbtsz346OJSod7Dl94';
+$token = '25451974-uakRmTZxrSFQbkDjZnTAsxDO5o9kacz2LT6kqEHA';
+$secret= 'CuQPQ1WqIdSJDTIkDUlXjHpbcRao9lcKhQHflqGE8';
+$twitterObj = new EpiTwitter($consumer_key, $consumer_secret, $token, $secret);
+$twitterObjUnAuth = new EpiTwitter($consumer_key, $consumer_secret);
+?>
+
+<h1>Single test to verify everything works ok</h1>
+
+<h2><a href="javascript:void(0);" onclick="viewSource();">View the source of this file</a></h2>
+<div id="source" style="display:none; padding:5px; border: dotted 1px #bbb; background-color:#ddd;">
+<?php highlight_file(__FILE__); ?>
+</div>
+
+<hr>
+
+<h2>Generate the authorization link</h2>
+<?php echo $twitterObjUnAuth->getAuthenticateUrl(); ?>
+
+<hr>
+
+<h2>Verify credentials</h2>
+<?php
+ $creds = $twitterObj->get('/account/verify_credentials.json');
+?>
+<pre>
+<?php print_r($creds->response); ?>
+</pre>
+
+<hr>
+
+<h2>Post status</h2>
+<?php
+ $status = $twitterObj->post('/statuses/update.json', array('status' => 'This a simple test from twitter-async at ' . date('m-d-Y h:i:s')));
+?>
+<pre>
+<?php print_r($status->response); ?>
+</pre>
+
+<script> function viewSource() { document.getElementById('source').style.display=document.getElementById('source').style.display=='block'?'none':'block'; } </script>
Please sign in to comment.
Something went wrong with that request. Please try again.