twitteroauth icon indicating copy to clipboard operation
twitteroauth copied to clipboard

Batch up multiple requests in a single network call

Open rafasashi opened this issue 8 years ago • 2 comments

I am using simultaneous HTTP requests in PHP with cURL to request multiple APIs in parallel.

I would like to get the options provided by the function request()in order to input them somewhere else.

Is it possible to do that without changing the source?

If not, could we work on some solution to batch up several requests to be sent in a single network call like google does here: https://developers.google.com/api-client-library/php/guide/batch

rafasashi avatar Jun 10 '16 10:06 rafasashi

Twitter doesn't support batching multiple requests together in a single connection like Google APIs does. The best that could be done would be to queue up several requests and make them in parallel. I haven't yet looked into how much work this would be to add.

abraham avatar Jul 03 '16 17:07 abraham

Thanks for your answer Abraham.

Here comes my implementation of curl_multi_exec for you

https://gist.github.com/rafasashi/ec8fa63155c1990e81f889cc3a053a0c

You can do GET or POST requests within the same call.

Let me know if I can help you.

rafasashi avatar Jul 03 '16 18:07 rafasashi

TwitterOAuth is in maintenance mode and major improvements are no longer planned. https://github.com/abraham/twitteroauth/issues/1188

abraham avatar Jul 24 '23 03:07 abraham