Twitter API returns Error 215, Bad Authentication Data

Few days ago Twitter change their API to new level API v1.1 and discontinued the support of XML, Atom, and RSS and instead they’re now supporting JSON only, although they give us warning few weeks before this moved is really a pain, this force us to migrate or upgrade our code to the new API, today I’ll try to give you solution but this only apply to PHP.


  • Download Twitter Oauth Library developed by Abraham
    – This is the first PHP Library to support OAuth for Twitter’s REST API
  • Create Twitter App at Twitter Developer site

After you’ve download and created twitter app then you’re good to go, please keep these records, you need this later to verify your authentication customer_key, consumer_secret, oauth_token and oauth_token_scret.

Sample Code

This code simply displays lists of user timeline in JSON format.

If you want to display other than user_timeline then you only needs to modify get() url.

Please share if you know other from PHP library that support OAuth, that help other developers who are also looking for solution, like for Ruby, Mobile Apps and more.

Happy Coding ^_^

by Ryan Sutana