My twitter feed response is started showing below message when i was tried to access users_timeline using this URL https://api.twitter.com/1/statuses/user_timeline.xml?include_entities=true&include_rts=true&screen_name=karthi0110&count=1
“The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.”
I have tried by replacing version 1 to 1.1 in the request URL https://api.twitter.com/1.1/statuses/user_timeline.xml?include_entities=true&include_rts=true&screen_name=karthi0110&count=1 it shown “Bad Authentication data” error. So after some research i have fixed it in a proper way.
If you are getting this error just migrate it to version 1.1 by following below steps.
Process is easy Create App -> Get access codes -> Configure -> Start displaying your feed
- Go to https://dev.twitter.com/apps/new and fill the form fields like Name, Description, Website.. in-order to create your app. Now agree the rules, fill captcha and click ‘Create your Twitter application’.
- If you have successfully created your app, you will find a button ‘Create my access token’ in ‘Your access token’ section. Just click that button to create your app access token.
- Once you have generated your access token we are ready to fetch our twitter feed. Download the files from https://github.com/themattharris/tmhOAuth.
- Now create a file twitter_feed.php, and put the following code and put your access/customer codes.
require 'tmhOAuth.php'; $tmhOAuth = new tmhOAuth(array( 'consumer_key' => 'CONSUMER_KEY', 'consumer_secret' => 'CONSUMER_SECRET', 'user_token' => 'ACCESS_TOKEN', 'user_secret' => 'USER_SECRET', )); $code = $tmhOAuth->request('GET', $tmhOAuth->url('1.1/statuses/user_timeline'), array('screen_name' => 'karthi0110','count'=>1)); $response = $tmhOAuth->response;