Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 321543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:51:19+00:00 2026-05-12T08:51:19+00:00

I make use of a great class made by Jaisen: http://github.com/jmathai/twitter-async/tree/master . Recently twitter

  • 0

I make use of a great class made by Jaisen: http://github.com/jmathai/twitter-async/tree/master. Recently twitter has been up and down and I am sure it will continue to be the same in the future so I am trying to cut down on my dependency on twitter being actually working.

The following is what I have in my header.php and it is right at the top and it generates the login URL for each user. If twitter is down, my site hangs for as long as it needs to and it throws an exception. So I have to catch these expceptions which I have sort of done.

I now want to just cancel the request to the API after a few seconds and just load the page and keep trying behind the scenes. How can I best do this?

<?php include './twitter/EpiCurl.php'; include './twitter/EpiOAuth.php'; include './twitter/EpiTwitter.php';
$consumer_key = 'mykey';
$consumer_secret = 'mysecret';

$twitterObj = new EpiTwitter($consumer_key, $consumer_secret); 

try{  

$twiturl = $twitterObj->getAuthenticateUrl();
$url = "window.open('".$twiturl."','Login', 'left=20,top=20,width=500,height=500,toolbar=0,resizable=1'); startLoad();";

}catch(EpiOAuthBadRequestException $e){  
  // bad request exception do something  
  $statusMessage = 'Oops an error has occurred: ' . $e->getMessage();  
}catch(EpiOAuthUnauthorizedException $e){  
  // bad authorization..probably bad tokens, do something different  
  $statusMessage = 'Oops an error has occurred: ' . $e->getMessage();  
}catch(EpiOAuthException $e){  
  // uh oh, unknown oauth exception  
  $statusMessage = 'Oops, an unknown authorisation error has occurred! The mojo team have been notified! Please try again.';
}

if(isset($statusMessage)){

}
?>

Any improvement of the above code will also be appreciated.

Thanks all

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:51:20+00:00Added an answer on May 12, 2026 at 8:51 am

    The library supports a value to be passed into the curl timeout.

    $twitterObj->setTimeout($secs_request_timeout);
    

    I just added support for passing in a connection timeout as well. Unable to run unit tests because I’m being rate limited. Will commit this once I can verify that it works.

    $twitterObj->setTimeout($secs_request_timeout, $secs_connection_timeout);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I make use of the Mydac components by devart (corelab) to access MySql from
I frequently make use of Request.QueryString[] variables. In my Page_load I often do things
I wanna make use of the Ternary Operator with an object. if($msg == 'hello'){
Is it possible to actually make use of placement new in portable code when
I would like to know how to make use of an Axiom database resource
I've written several scripts that make use of the gdata API, and they all
I'm writing an app that will need to make use of Timer s, but
I'm in the process of planning an application that would make use of the
I'm currently building a project and I would like to make use of some
Are there any sorts of useful idioms I can make use of when writing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.