Auto post on Twitter with PHP - Twitter API

Twitter provide API which we can use for auto post on twitter wall. So here are the few steps for the use of twitter API. This is very simple process. You will have to follow only few step for using the PHP API.

How to use twitter API for auto posting on twitter wall?

Create twitter APP:-  

First of all we have to create an account on twitter and then we have to go on twitter developer website (https://dev.twitter.com/apps) and sign in twitter account. After that we will go to create for twitter app. Press "create new application link on twitter developer website  and create a new twitter app. This is very simple, after filled all required fields your twitter application will be ready for use. After the creation of twitter app, we will get the CONSUMER_KEY, CONSUMER_SECRET, OAUTH_SECRET keys for entering in the index file.



Create twitter access token:-

After successfully creation of twitter app. Now we will have to go twitter access token, that will use for twitter login and posting. This is very simple, there will be a button for create access token press on that button then you get your access token. Copy that code, this code will enter on the place of OAUTH_TOKEN in the index file.

Download PHP library or PHP API from GitHub:-

Now we will go to for download the php library or PHP API from the GitHub website. Here is the link for download PHP library (https://github.com/jublo/codebird-php) where we can download the php library.

Setup of PHP API and Index.php file:-

Finally all these step has been completed. Now we will have to setup of twitter API and create a new index.php file on the outside of the twitter API folders and put  the CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET in the PHP API code which we got from php app. Now there is one question that is where does we get the code of index file, for the code of index file you can go here ( http://www.tech-faq.com/send-tweets-to-your-twitter-account-via-php.html ), here you will find the index.php file code, copy that code and paste it on index file. Now enter all the keys and twitter access token in index.php file.
After that please run the index.php file and you will get the result on twitter wall.

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);

this is the line of code where you will have to enter the access token and all the secret key. After all setup when you hit the twitter API output then it will work and post automatically on your twitter wall ( which you have loged in ). You can test it also on localhost by using any free local-server like xamp or wamp. There is no other different process for localhost, this is a common process.

Also Read - How to Trend on Twitter Quickly

2 comments:

  1. I have you bookmarked your site to look at the new stuff you post.
    Buy Bulk Twitter accounts

    ReplyDelete
  2. Thanks a lot for your positive feedback.

    ReplyDelete