Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fatal error: Uncaught exception 'EpiOAuthException' #71

Closed
BooLeeaaN opened this Issue · 40 comments

9 participants

BooLeeaaN Jaisen Mathai texmex5 Will Vaughn Jamie McElwain jmanpa Aaron ajinkya teo1978
BooLeeaaN

Fatal error: Uncaught exception 'EpiOAuthException' in /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php:397
Stack trace:
#0 /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php(367): EpiOAuthException::raise(Object(EpiCurlManager), false)

#1 /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php(39): EpiOAuthResponse->__get('oauth_token')

#2 /home/teamwork/public_html/game/application/modules/account/controllers/sign_in_twitter.php(30): EpiOAuth->getAuthenticateUrl()

#3 /home/teamwork/public_html/game/system/codeigniter/CodeIgniter.php(236): Sign_in_twitter->index()

#4 /home/teamwork/public_html/game/index.php(116): require_once('/home/teamwork/...')

#5 {main} thrown in /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php on line 397

any help?

Jaisen Mathai
Owner

I recently added a simpleTest.php script to the repository. Could you run that and see what the output is?

BooLeeaaN

Single test to verify everything works ok
View the source of this file
<?php
include 'application/modules/account/plugins/libraries/jmathai-twitter-async/EpiCurl.php';
include 'application/modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php';
include 'application/modules/account/plugins/libraries/jmathai-twitter-async/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);
?>

Single test to verify everything works ok

View the source of this file


Generate the authorization link

<?php echo $twitterObjUnAuth->getAuthenticateUrl(); ?>


Verify credentials

<?php
$creds = $twitterObj->get('/account/verify_credentials.json');
?>

response); ?>

Post status

<?php
$status = $twitterObj->post('/statuses/update.json', array('status' => 'This a simple test from twitter-async at ' . date('m-d-Y h:i:s')));
?>

response); ?>

Blog | S
Generate the authorization link
http://twitter.com/oauth/authenticate?oauth_token=52NhIQS9XSop3iNLoQQIYB7461ZrqgX5rBFcvndiw
Verify credentials

Fatal error: Uncaught exception 'EpiTwitterException' in /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiTwitter.php:262
Stack trace:
#0 /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiTwitter.php(218): EpiTwitterException::raise(Object(EpiCurlManager), false)
#1 /home/teamwork/public_html/game/simpleTest.php(32): EpiTwitterJson->__get('response')
#2 {main}
thrown in /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiTwitter.php on line 262

BooLeeaaN

Generate the authorization link

Fatal error: Uncaught exception 'EpiOAuthException' in /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php:397 Stack trace: #0 /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php(367): EpiOAuthException::raise(Object(EpiCurlManager), false) #1 /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php(39): EpiOAuthResponse->__get('oauth_token') #2 /home/teamwork/public_html/game/simpleTest.php(23): EpiOAuth->getAuthenticateUrl() #3 {main} thrown in /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiOAuth.php on line 397

BooLeeaaN

Generate the authorization link
http://twitter.com/oauth/authenticate?oauth_token=5dkLOF0qKb4JVSWrRnZDwaJ9OykbEKpJChGha3oGPrY
Verify credentials

Fatal error: Uncaught exception 'EpiTwitterException' in /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiTwitter.php:262
Stack trace:
#0 /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiTwitter.php(218): EpiTwitterException::raise(Object(EpiCurlManager), false)
#1 /home/teamwork/public_html/game/simpleTest.php(32): EpiTwitterJson->__get('response')
#2 {main}
thrown in /home/teamwork/public_html/game/application/modules/account/plugins/libraries/jmathai-twitter-async/EpiTwitter.php on line 262

Jaisen Mathai
Owner

So is the exception thrown sporadically?

I had a hard time reading your posts since github mangled the source a bit. Any chance you could put it up on pastebin and link to it or give me temporary access to the box you're working on?

texmex5

I think this error might have something to do with Twitter API downtime. Got the exact same error on the same line. Googled a bit and then it suddenly started working again.

Jaisen Mathai
Owner

Ok, if the same code worked now but not before then I'm closing and chalking it up to API flakiness :).

Will Vaughn

I'm getting the same thing, its not API flakiness. It will not go away and its beyond me to understand what's happening.

All I'm trying to do is use an oauth_callback and get it to redirect back to where I specify. I passed the arguments to AuthorizeUrl and getAccessToken as you described in the documentation and I get this exception error, same line 397.

Jaisen Mathai
Owner

@EndOvAnEra Can I have access to a server where this is happening?

Will Vaughn

I am going to use a twitter button and forget about using the api for now. I changed my page back to the way it was before. The entire reason I was going the api route was to not use their standard issue tweet button. But since I can't get it to function...I'll do it later. I would like to know what is wrong with my files that were failing however. I am running on a short time schedule today, but I will try to get you a look at the code I was using in the next 48 hours. Maybe I'm just missing something obvious, or don't understand a major concept or your script.

Jamie McElwain

Can you guys confirm it's the API? I'm having the issue too.

Will Vaughn

Here is the index.php page that references your Epitwitter scripts
I stole it and adapted it from http://www.1stwebdesigner.com/tutorials/twitter-app-oauth-php/

You can see I commented out the code where I actually tried to pass the parameters for the callback, it fails either way.

<?php

session_start();
include 'lib/secret.php';
include 'lib/EpiCurl.php';
include 'lib/EpiOAuth.php';
include 'lib/EpiTwitter.php';

// I'm adding in my wrapper top right here, up until the point where it comes to the twitter button
include 'wrappertop.php';

$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);
$oauth_token = $_POST['oauth_token'];
if($oauth_token == '')
{
//$url = $twitterObj->getAuthenticateUrl(null, array('oauth_callback' => 'http://link.to.mysite/diff/callback'));
$url = $twitterObj->getAuthorizeUrl(); //i added that arguement above
echo "twitter";

include 'wrapperbtm.php';

}
else
{
$twitterObj->setToken($_POST['oauth_token']);
//$token = $twitterObj->getAccessToken(array('oauth_verifier' => $_GET['oauth_verifier']));
$token = $twitterObj->getAccessToken(); // I added the argument above
$twitterObj->setToken($token->oauth_token, $token->oauth_token_secret);
$_SESSION['ot'] = $token->oauth_token;
$_SESSION['ots'] = $token->oauth_token_secret;
$twitterInfo= $twitterObj->get_accountVerify_credentials();
$twitterInfo->response;

$username = $twitterInfo->screen_name;
$profilepic = $twitterInfo->profile_image_url;

include 'tweetbox.php';
include 'wrapperbtm.php';

}

if(isset($_POST['submit']))
{
$msg = $_REQUEST['tweet'];

$twitterObj->setToken($_SESSION['ot'], $_SESSION['ots']);
$update_status = $twitterObj->post_statusesUpdate(array('status' => $msg));
$temp = $update_status->response;

echo "

Updated your Timeline Successfully .
";

}

?>

Will Vaughn

I also tried using $_GET and changing all the method params in EpiOAuth to 'GET'

Jaisen Mathai
Owner

Reopening for now...

@jgmcelwain Can you provide me access to a server you're seeing this on?

@EndOvAnEra change everything to $_REQUEST. That's the safest bet. I know that oauth_token is a GET variable which should be picked up in $_REQUEST.

jmanpa

I'm getting the same error. I get it with the simpletest:

[Tue Aug 24 14:23:33 2010] [error] [client ::1] PHP Fatal error: Uncaught exception 'EpiOAuthException' in /Library/WebServer/Documents/ts/system/application/libraries/EpiOAuth.php:397\nStack trace:\n#0 /Library/WebServer/Documents/ts/system/application/libraries/EpiOAuth.php(367): EpiOAuthException::raise(Object(EpiCurlManager), false)\n#1 /Library/WebServer/Documents/ts/system/application/libraries/EpiOAuth.php(39): EpiOAuthResponse->__get('oauth_token')\n#2 /Library/WebServer/Documents/ts/system/application/controllers/testusers.php(23): EpiOAuth->getAuthenticateUrl()\n#3 {main}\n thrown in /Library/WebServer/Documents/ts/system/application/libraries/EpiOAuth.php on line 397

Jaisen Mathai
Owner

So, I really need access to someone's server that's having this problem. I can't reproduce this on any of my environments. Let me know if I can have a temporary account.

jmanpa

I'm on a mac client, so not using a server to give you access to.

Jaisen Mathai
Owner

@jmanpa, same here. Here is what I get.

jmathai@[~/Y/twitter-async]: php --version | HEAD -1
PHP 5.2.6 (cli) (built: Nov 16 2008 22:58:36) 

jmathai@[~/Y/twitter-async]: php -i | grep libcurl
cURL Information => libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3

jmathai@[~/Y/twitter-async]: php simpleTest.php

Single test to verify everything works ok

[SNIP]

Generate the authorization link

http://twitter.com/oauth/authenticate?oauth_token=XoiT6p8FO94VMFojD4kJ5dvA6fWeXTzaKbp4hMN6Q

Verify credentials

Array ( [verified] => [notifications] => [profile_use_background_image] => 1 [time_zone] => Pacific Time (US & Canada) [profile_background_color] => 9ae4e8 [description] => [lang] => en [created_at] => Fri Mar 20 03:30:42 +0000 2009 [location] => [status] => Array ( [coordinates] => [in_reply_to_user_id] => [created_at] => Tue Aug 24 19:00:54 +0000 2010 [contributors] => [retweeted] => [favorited] => [in_reply_to_status_id] => [source] => Blog post test [place] => [in_reply_to_screen_name] => [retweet_count] => [truncated] => [id] => 22023416769 [geo] => [text] => This a simple test from twitter-async at 08-24-2010 12:00:53 ) [profile_background_image_url] => http://a1.twimg.com/profile_background_images/108739880/myphoto2.jpg [profile_text_color] => 000000 [listed_count] => 0 [statuses_count] => 2487 [following] => [profile_background_tile] => 1 [profile_link_color] => 0000ff [show_all_inline_media] => [followers_count] => 17 [profile_image_url] => http://a0.twimg.com/profile_images/958995000/avatar_test_image_normal.jpg [contributors_enabled] => [favourites_count] => 1 [profile_sidebar_fill_color] => e0ff92 [friends_count] => 5 [protected] => [screen_name] => jmathai_test [profile_sidebar_border_color] => 87bc44 [name] => Jaisen [geo_enabled] => [id] => 25451974 [follow_request_sent] => [utc_offset] => -28800 [url] => )

Post status

Array ( [coordinates] => [in_reply_to_user_id] => [created_at] => Tue Aug 24 19:02:47 +0000 2010 [contributors] => [retweeted] => [favorited] => [in_reply_to_status_id] => [source] => Blog post test [place] => [in_reply_to_screen_name] => [user] => Array ( [notifications] => [profile_use_background_image] => 1 [time_zone] => Pacific Time (US & Canada) [profile_background_color] => 9ae4e8 [description] => [lang] => en [created_at] => Fri Mar 20 03:30:42 +0000 2009 [followers_count] => 17 [location] => [profile_background_image_url] => http://a1.twimg.com/profile_background_images/108739880/myphoto2.jpg [profile_text_color] => 000000 [listed_count] => 0 [friends_count] => 5 [statuses_count] => 2488 [following] => [profile_background_tile] => 1 [profile_link_color] => 0000ff [show_all_inline_media] => [favourites_count] => 1 [profile_image_url] => http://a0.twimg.com/profile_images/958995000/avatar_test_image_normal.jpg [contributors_enabled] => [profile_sidebar_fill_color] => e0ff92 [geo_enabled] => [protected] => [screen_name] => jmathai_test [profile_sidebar_border_color] => 87bc44 [name] => Jaisen [verified] => [id] => 25451974 [follow_request_sent] => [utc_offset] => -28800 [url] => ) [retweet_count] => [truncated] => [id] => 22023533796 [geo] => [text] => This a simple test from twitter-async at 08-24-2010 12:02:47 ) [SNIP]
jmanpa

I increased my php logging size and got the whole response from Twitter, which is a 'sorry that page doesn't exist', so the twitter url must be getting hosed somehow, but it is making it to Twitter at least.

What line of code can I put a debugger breakpoint in to see the url just before it is called?

Jaisen Mathai
Owner

Are you using simpleTest.php without any modifications? I don't see how the url can be getting messed up on your laptop but not mine.

Can you provide the output of the following commands?

jmathai@[~/Y/twitter-async]: php --version | HEAD -1
jmathai@[~/Y/twitter-async]: php -i | grep libcurl

jmanpa

nevermind, found it.

$url looks like this: http://twitter.com/.json
and $params looks like this: /account/verify_credentials.json

jmanpa

Jaisen, ignore the url problem above. I forgot that I switched between an old and new version of Epitwitter after I ran into the 397 error. So I'm back to EpiOAuth.php:397 being an issue.

I just put simpletest on a server of mine at hostgator and everything works fine. Not sure what the issue is on my mac. I feel better that some others have seen it too and it's not just me.

Jaisen Mathai
Owner

Ha, ok. I'm still unsettled as to whether this is a problem with the library, twitter's api or an environmental issue.

Closing this until I can get access to a server to reproduce the problem.

Aaron

I am also getting this error. I will be glad to give you access to my server to look at this.

Here is the output of the command that you requested to someone earlier:

root@christa [~]# php -i | grep libcurl
cURL Information => libcurl/7.19.4 zlib/1.2.3 libidn/0.6.5

Jaisen Mathai
Owner

You can email me a username/password at jaisen@jmathai.com.

Jaisen Mathai
Owner

Resolved @aaronsnet by removing an invalid character from his token.

jmanpa

Maybe you can describe a little more detail of the issue you found. My code works, unchanged, on my remote server but not on my local mac, so since the code is identical, it must be environmental with my configuration.

Jaisen Mathai
Owner

@jmanpa, I can check it out if you provide access to the system where it's broken.

Deleted user

@jmathai - Also having the same problem - I just emailed you with my connection information. Hope you can help - thanks!

ajinkya

I am also getting the same error.
However when i use the older version of the files posted on the blog, it works fine.
When i use the new version on github, i get the exception. None of the methods work.

Also on the version posted in blog(old version).. only method calls work.
i.e.
This works
$userInfo = $twitterObj->get_statusesFriends_timeline();

While This:
$userInfo = $twitterObj->get('/account/verify_credentials.xml');
gives error:
Warning: Invalid argument supplied for foreach() in EpiOAuth.php on line 116

Server Info:
PHP Version 5.2.14
cURL Information libcurl/7.13.2 OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13

Jaisen Mathai
Owner

@ajinkya You need to use the .json endpoints instead of .xml. Let me know if that resolves it for you.

teo1978

I am experiencing the same issue.
Only it is line 393 not 397 (but maybe it's just because the code has changed a bit since this was first reported).

It's not intermittent, it's 100% of the times.
My script is as simple as this:

The $consumer_key and $consumer_secret variables set in the "secret.php" file are correct.

<?php
include 'EpiCurl.php';
include 'EpiOAuth.php';
include 'EpiTwitter.php';
include 'secret.php';
?>


<?php
$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);

echo '<a href="' . $twitterObj->getAuthorizeUrl() . '">Authorize with Twitter</a>';

teo1978

same thing if I run simpleTest.php

Jaisen Mathai
Owner

What's your OS name/version?

Also, if you're running osx or linux what's the out put of these commands?

php --version
php -i | grep curl

teo1978

It's linux, dunnow the distribution and version. I don't have access to the command line so I can't try those command but this is a link to a script calling phpinfo():
http://creaciodigital.upf.edu/~msisti/test/phpinfo.php
PHP Version 5.2.0-8+etch16
cURL support enabled
cURL Information libcurl/7.15.5 OpenSSL/0.9.8c zlib/1.2.3 libidn/0.6.5

On the same server, an older version of your library (the one that comes bundled with a tutorial of yours) works. Also, twitteroauth by Abraham Williams works.

Jaisen Mathai
Owner
teo1978

Tried, nothing changes

Jaisen Mathai
Owner

If twitteroauth works then I'd suggest using it - it's a good lib and Abraham's a trustworthy coder.

I believe the problem has to do with your version of curl (≈5 years old). TwitterOAuth uses regular curl and twitter-async uses multi curl. If you don't need to make a large number of requests in parallel then TwitterOAuth works just as well.

It will be faster than waiting on me to debug your problem without SSH access.

teo1978

Thank you for the advice and for your honesty. I guess I'll use twitteroauth, I definitely don't need a large number of (nor even more than one) requests in parallel.

May I suggest you reopen this issue as it is not solved?
Sorry I cannot give you access to the server to help you debug the issue - the server is not mine ;)

Jaisen Mathai
Owner

Done. I created a new issue since this one covers several different problems.
https://github.com/jmathai/twitter-async/issues#issue/103

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.