Monday 15 April 2013

Twitter apps tutorial

Twitter has a good set of flexible apis which you can use to develop large set of apps.

To start , register a new app from your twitter account, here .
If you are hosting your app in localhost then in 'website' and 'callback url' fields enter the localhost url , something like http://localhost/twitterapp/ ; In case it doesn't get accepted try replacing localhost with 127.0.0.1 or change browser.

Once your app is registered. Download libraries in the programming language of your choice from here .

Once that is done you can start coding on your app.

(Please note you have to use the consumer key and consumer secret provided here in your app development )

The api offered from twitter allows you to

  • Read Tweets from your timeline.
  • See who you follow, and follow new people.
  • Update your profile.
  • Post Tweets for you.
  • Access your direct messages.

for accessing direct messages, you need to select  'Read, Write and Access direct messages' in application access type , provided in the application register page.


Once the user signs in , your application will receive an Oauth token which can be stored in a local Database so that you can have offline (user) account access.
Also once you are aware of a tweet id or user id, you can get offline/online details of it using several api's.



You need to edit the config.php to mention the consumer and secret keys along with the path to callback.php

And specify the path to the main php code aka index.php in callback.php once the user verification is complete

You can customize the signup page in connect.php




Happy coding.

No comments:

Post a Comment