I watch this video to learn how to post a tweet to Twitter account using PHP. I grab the PHP he give in the video description & add my Application & Access Token details inside the script.
This is my code.
<?php
$the_tweet = 'hello';
// TWITTER API ==================
$consumerKey = 'qu...xF';
$consumerSecret = 'it...hG';
$oAuthToken = '24...ub';
$oAuthSecret = 'oy...d2';
include "OAuth.php";
include "twitteroauth.php";
$tweet = new TwitterOAuth($consumerKey, $consumerSecret, $oAuthToken, $oAuthSecret);
if (isset($the_tweet)) {
$tweetmsg = $the_tweet;
$tweet->post('statuses/update',array('status' => $tweetmsg));
echo "Your message has been sent to Twitter.";
} else {
echo "Your message has not been sent to Twitter.";
}
// END TWITTER API ==================
?>
The github repo for this script is here ('OAuth.php' and 'twitteroauth.php' files inside the 'twitteroauth' folder).
MY PROBLEM
When I run my code with localhost (using MAMP), the tweet successfully sent to my Twitter account.
But, when I put it on my web hosting account and run the code, the tweet not sent to my Twitter account even I still get the success message like below.

How to fix this problem? Why the tweet is not sent and only sent successfully in localhost mode?
This is my Application & Token Access details (it's same like in my code):

$tweet->post? make it a variable and dump it,$test = $tweet->post('statuses/update',array('status' => $tweetmsg)); var_dump($test);– Mihai Iorga Apr 24 '14 at 8:29