Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

How can I get Exception issue ? #282

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

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;
}
@J7mbo J7mbo closed this as completed Jan 15, 2025
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants