Auto post on Twitter with PHP - Twitter API

Create twitter APP:-  

Steps - 

1- Create an account on Twitter 
2- Sign in to -
3- Create Twitter App.
4 - Press "create new application link on twitter developer website
5-   Create a new Twitter app.
7 - Enter Consumer key, consumer secret, OAuth secret to 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 ( 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 ( ), 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.


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

Post a Comment