Online Support

HostingJuice

Exclusive HostingJuice Offers

20% discount on shared hosting packages

For all our visitors from IBS we offer this unique chance. Order Online!
Promotion code: IBS20
 
Twitter with OAuth PDF Print E-mail
Share

Basic Authentication  was used to send user credentials through the header of HTTP request. That made it easy to use, but insecure. OAuth is now the preferred method of Twitter as a method of authentication. From August 2010 Basic Auth will be turned off from the API, causing that you current API (based on Basic Auth) will stop working soon (if you are not already receiving the Basic authentication is not supported error message).

So in order to keep publishing our Twitter messages on our website, we have to implement the OAuth method and we have to implement a form of caching to overcome that messages are not published due to the requests per hour limit.

After reading this simple turtorial and downloading the available examples, you will be able to publish your messages again within 15 minutes. The turtorial and example files are based on using a PHP environment.

First download the example package which includes a readme.txt file for offline reading.

 

1) Register a new application at: https://twitter.com/apps
2) Fill in the requested fields, use for Application Type: browser
3) Copy the Consumer key value to:

globals.php -> OAUTH_CONSUMER_KEY
tweet.php -> OAUTH_CONSUMER_KEY

4) Copy the Consumer secret value to:

globals.php -> OAUTH_CONSUMER_SECRET
tweet.php -> OAUTH_CONSUMER_SECRET

5) Access the getreqtok.php file with your browser
6) Copy the oauth_token value to:

tweet.php -> $access_token

7) Copy the oauth_token_secret value to:

tweet.php -> access_token_secret

6) Copy the entire line after Have user surf to and paste it in a new browser window
7) Click the allow button
8) Save the generated code for future usage
9) Open tweet.php, it should display the latest status text message from you Twitter account

Crab the content of the $text variable and publish it on the location you need it to appear.