comments 2

Update Twitter Status using CLI

Hi comrades !! :redface: , what will you do on weekend ?? ,, doing a trip ? hanging out :musik: ? whatever you will do, Hope it will be useful or giving something new for you. Okay , today I will share about How to update your twitter status using command line interface. We still using PHP :lol:

Firstly, you must create your own application in twitter, just go to https://dev.twitter.com/apps and create one , so you will have some keys like Consumer key, Consumer secret, Access token and Access token secret . Don’t forget to set your app access to read and write.

accesstoken

 

Sorry for censored the keys because that very important, with those keys we can access our twitter account. after we get the keys , so its time to coding 8) , we need an open protocol to allow secure authorization for this tool. we can grab it on
https://github.com/abraham/twitteroauth/tree/master/twitteroauth


Sponsored links



Then put all files in one folder with our tool. and here is the codes of our tool.

 
<?php
 
# Update Twitter with CLI
# Rosdyana Kusuma -  admin@r3m1ck.us
# Exploit-ID :: IndonesianCoder :: KebumenCyber

require_once 'twitteroauth.php'; 
 
class TwitterUpdate{
 
	function __construct($content){
 
		if(empty($content)){
			$this->help();
			exit;
		}
 
		//this is important , fill with your key
		$consumerKey    = 'your_consumer_key';
		$consumerSecret = 'your_consumerSecret_key';
		$oAuthToken     = 'your_auth_token_key';
		$oAuthSecret    = 'your_auth_secret_key';
		//
 
		$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
 
		$tweet->post('statuses/update', array('status' => "$content"));
	}
 
	function help(){
 
		print "\nHow to using :\n";
		print "update_twitter.php < fill with your status > \n";
		print "update_twitter.php 'eat , pray, code...' \n";
 
	}
 
}
 
$twitterUpdate = new TwitterUpdate($argv[1]);
 
?>

you can run it with command line now ,
run_it

Happy Coding Comrades !! 8)

2 Comments

  1. john

    I’m trying your method, but I get an error on line
    “$tweet->post(‘statuses/update’, array(‘status’ => “$content”));”
    I don’t know php, so any help would be appreciated.
    Thank you.

Leave a Reply

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