Default Image

Months format

Show More Text

Load More

Related Posts Widget

Article Navigation

Contact Us Form

404

Sorry, the page you were looking for in this blog does not exist. Back Home

Auto post on Twitter with PHP - Twitter API

Create a Twitter APP:-  

Steps - 

1- Create an account on Twitter 
2- Sign in to -  https://dev.twitter.com/apps
3- Create Twitter App.
4 - Press "create new application link on Twitter developer website
5-   Create a new Twitter app.
6- Note CONSUMER_KEY, CONSUMER_SECRET, OAUTH_SECRET
7 - Enter Consumer key, consumer secret, OAuth secret to the index file.



Create twitter access token:-

After the successful creation of the Twitter app. Now we will have to go twitter access token, which will use for Twitter login and posting. This is very simple, there will be a button for creating an 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 download the PHP library or PHP API from the GitHub website. Here is the link for download the 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 steps have been completed. Now we will have to setup up 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 the PHP app. Now there is one question that is where do 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 tokens in the index.php file.
After that please run the index.php file and you will get the result on the 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 keys. After all, set up when you hit the Twitter API output then it will work and post automatically on your Twitter wall ( which you have logged 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

1 comment

  1. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. Michael Keaton Vulture Jacket

    ReplyDelete