Auto Post Tweets on Twitter via API Using PHP

Auto Post Tweets on Twitter via API Using PHP

In this Post We Will Explain About is Auto Post Tweets on Twitter via API Using PHP With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Send Tweets to your Twitter Account via PHP Example

In this post we will show you Best way to implement Auto Post on Facebook with PHP script , hear for twitter – How to auto tweet via API in php using localhost with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  Vue js Drag and Drop Customizable list - step by step

How to Create a Twitter app

Step 1 – First of all Go to https://dev.twitter.com/apps and sign in with your twitter account.

Step 2 – and then Press ‘Create a new application’ push button

Step 3 – Complete the all required fields and put simple ‘Create your Twitter application’

Step 4 – Go to simple ‘Settings’ TAB and set here Application Type to privacy and policy ‘Read and Write’. After that press ‘Update this Twitter some twitter application’s settings’

Step 5 -and then Go to Details Twitter TAB and press simple ‘Create my access token’ push button

Step 6 – Last step Twitter oAuth simple tool TAB and get some keys your access tokens

READ :  Angular Highcharts Application PHP MySQLi

Example of the Send Tweets to your Twitter Account via PHP

<?php

require_once 'twitteroauth.php';
require('../wp-blog-header.php');


define("CONSUMER_KEY", "YourKEYnVjnDU5XlhF40");
define("CONSUMER_SECRET", "udFDFDFKEJSSM5441245ss45s4s4s54s54s55s45s");
define("OAUTH_TOKEN", "9852566666-likAASKASAS5656asdsjfsf5555AASSssss");
define("OAUTH_SECRET", "qWefgthlive52ksjKKLMANhjhjgghAA578485lkmsjjsWQ");


$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
$content = $connection->get('account/verify_credentials');

global $wpdb;
$titles = $wpdb->get_col(
	"SELECT *
	FROM $wpdb->posts
	WHERE post_type = 'post'
	AND post_author = 1 
	AND post_status IN ('publish')  ORDER BY rand() LIMIT 1"
	
);

foreach($titles as $val)
{
$label =  get_the_title($val);
$post_url = get_permalink($val);
echo $link = $label." ".$post_url;
$params = array(
  'status' => $link,
  'media[]' => 'https://infinityknow.com/live_logo.jpg'
);
$connection->post('statuses/update', $params);
}

?>

You are Most welcome in my you tube Channel Please subscribe my channel. and give me Feed Back.
More Details……

Angularjs Example

Example

I hope you have Got What is How to Auto Post on Twitter with PHP And how it works.I would Like to have Feed Back From My Blog(Pakainfo.com) readers.Your Valuable Feed Back,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

READ :  Social Media Auto Post on Google Plus Using PHP API

We hope you get an idea about Auto Post Tweets on Twitter via API Using PHP
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Add a Comment

Your email address will not be published. Required fields are marked *