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

Do I need to call "new TwitterAPIExchange($settings)" before every API request ? #248

Open
Cedric-IEF2I opened this issue Oct 2, 2017 · 2 comments

Comments

@Cedric-IEF2I
Copy link

Cedric-IEF2I commented Oct 2, 2017

Hello, I am sorry if it's a stupid question, but do I need to call "new TwitterAPIExchange($settings)" before every API request ?

ie :
Do I have to do :
$API = new TwitterAPIExchange($settings);
$result1 = json_decode( $API->setGetfield( "?user_id=1015908282&tweet_mode=extended&exclude_replies=true&include_rts=1&count=200" )
->buildOauth( "https://api.twitter.com/1.1/statuses/user_timeline.json", "GET" )
->performRequest(), true );

$API = new TwitterAPIExchange($settings);
$result2 = json_decode( $API->setGetfield( "?slug=list&$setGetfield" )
->buildOauth( "https://api.twitter.com/1.1/lists/statuses.json", "GET" )
->performRequest(), true );


Or can I do :
$API = new TwitterAPIExchange($settings);

$result1 = json_decode( $API->setGetfield( "?user_id=1015908282&tweet_mode=extended&exclude_replies=true&include_rts=1&count=200" )
->buildOauth( "https://api.twitter.com/1.1/statuses/user_timeline.json", "GET" )
->performRequest(), true );

$result2 = json_decode( $API->setGetfield( "?slug=list&$setGetfield" )
->buildOauth( "https://api.twitter.com/1.1/lists/statuses.json", "GET" )
->performRequest(), true );


Thanks for your help !

@EwenH
Copy link

EwenH commented Oct 2, 2017

Frederic,
You should be able to call the settings a single time at the top unless you are using multiple twitter accounts. I don't have access to the code currently but testing both options should be simple to do.

@Cedric-IEF2I
Copy link
Author

Thank you ExenH ! I already tested it on a small script and it seemed to work fine but I wanted to make sure because I am going to handle massive amounts of data.

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

2 participants