How to programmatically (PHP) authenticate my app so it can retrieve my own followers and the followers of my partners?


#1

All the OAuth docs and code samples I’m finding, both at twitter.com and elsewhere, seem to assume that as an app developer I will want to set up a process wherein human users can authenticate. Most of these code samples are for situations where the developer wants to write an interface for tweeting.

What about something like retrieving a list of followers? The docs indicate that to do this, I must authenticate my app: https://dev.twitter.com/docs/api/1/get/followers/ids

I see that my first move is to get a token, and the docs for that are here: https://dev.twitter.com/docs/api/1/post/oauth/request_token
However, I’m not sure how to do the post that’s described at the bottom of that page. I’m not sure what that’s going to look like in PHP. Is it something like this: http://wezfurlong.org/blog/2006/nov/http-post-from-php-without-curl/

Or, perhaps I’m overlooking some easier way to retrieve all followers for an account? The followers will most likely number in the thousands, but almost certainly not hundreds of thousands. Probably south of 50,000.

Thank you,
Ryan


#2

I’d strongly suggest using the tmhOAuth library for this: https://github.com/themattharris/tmhOAuth

It will handle the authentication, and is nicely documented and has several examples: https://github.com/themattharris/tmhOAuth/tree/master/examples


#3

#4

I recommend my own library https://github.com/vojant/Twitter-php It’s really simple and let you login as application or single-user to make api calls.

More details and examples on: https://github.com/vojant/Twitter-php