Skip to content

Instantly share code, notes, and snippets.

@Fabax
Created February 6, 2013 19:19
Show Gist options
  • Save Fabax/4725013 to your computer and use it in GitHub Desktop.
Save Fabax/4725013 to your computer and use it in GitHub Desktop.
PHP : AutoTweet traitement
<?php
if(isset($_POST['new_tweet']))
{ #[a-z]#
$random = rand(1,7);
$consumerKey = 'lCZMlvltc7Fy84eOJLh0fg';
$consumerSecret = 'hGVSBcsJYDLtXu4apNOMGM0ec6yBQvGpdCiKGhOChQ';
$oAuthToken = '1020259956-n42wkK3PrBtVBcTR8oWyS8kWg3hcVCfc74aId0P';
$oAuthSecret = 'yPwYJerYxySbj7dSpJBYZ6mv2ZK1i4cOhbrlFSlJJA';
require_once('twitteroauth.php');
// create a new instance
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
$message = stripslashes($_POST['new_tweet']);
if($random == 1){
$random = rand(1,2);
if($random == 1){
$messageExtra .= " http://ref.moufbox.fr/";
}else{
$messageExtra .= " #kokolitolithe";
}
}else{
$messageExtra .= "";
}
$letters = strlen($_POST['new_tweet']);
if($letters <= 126){
$tweet->post('statuses/update', array('status' => ''.$message.''.$messageExtra));
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment