Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I get Exception issue ? #282

Open
pascal37stage opened this issue Jun 20, 2019 · 0 comments
Open

How can I get Exception issue ? #282

pascal37stage opened this issue Jun 20, 2019 · 0 comments

Comments

@pascal37stage
Copy link

Hello,
I would like to know if it is possible to get an Exception from a try catch for my Twitter API ?
Indeed when I have some issue from acces token or consumer_key I don't get any Exception from the API in order to explain me why it doesn't work and where to find the problem.

Here is the code :
$requestMethod = "GET";

$settings = array(
    'oauth_access_token' => $config['access_token'],
    'oauth_access_token_secret' => $config['access_token_secret'],

    'consumer_key' => $config['consumer_key'],
    'consumer_secret' => $config['consumer_secret']
);


$getfield = '?screen_name=' . $config['name'] . '&count=20&tweet_mode=extended';
try{ 
$twitter = new TwitterAPIExchange($settings);

$resultat = $twitter->setGetfield($getfield)

    ->buildOauth($url, $requestMethod)
    ->performRequest();

$data = json_decode($resultat);
}
catch (Exception $e)
{
   echo 'Twitter API return an error '.$e->getMessage();
   exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant