QuestionsTwitter post share with PHP
mmWebetutorial Staff asked 9 months ago

<?php
require_once(‘oauth/twitteroauth.php’); // twitter library
define(‘CONSUMER_KEY’, ‘4jO1Y5oweNAj9O9Ra8HSwHmg9’);
define(‘CONSUMER_SECRET’, ‘NEY7rWJU8tID2gRh0v8u4sAsE4y6M5vAxd135SpI7Vp3XXXXX’);

$_SESSION[‘access_token’] = ‘791092077052387328-RXvKSGq14fwUQXnXXXXXXX’;
$_SESSION[‘oauth_token_secret’] = ‘QJ2aDZtxgoRahH4vczwDzGJtK1XAvTtXXXXXxxXX’;
$access_token[‘oauth_token’] = ‘791092077052387328-RXvKSGq14fwUQXnB8izFIXXxxxXXXX’;
$access_token[‘oauth_token_secret’] = ‘QJ2aDZtxgoRahH4vczwDzGJtK1XXXXXxXXkSOhg’;

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token[‘oauth_token’], $access_token[‘oauth_token_secret’]);

$input = array(‘#news ‘,’#newspaper ‘,’#technology ‘,’#science ‘);

$rand_keys = array_rand($input, 2);
//echo $input[$rand_keys[0]] . “\n”;
//echo $input[$rand_keys[1]] . “\n”;

//aarray end

$setfetchqueryposttitl = ‘Join & share your Question or Issue with us’;

//echo ‘The short URL is:  ‘.$short;
$txt = $setfetchqueryposttitl . ‘ ‘ . $input[$rand_keys[0]] . $input[$rand_keys[1]] . ‘@webetutorial’;

$connection->post(‘statuses/update’, array( ‘status’ => “$txt” ));

echo $message = “Tweeted Sucessfully!!”;

?>

 

Your Answer
Login
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.