I went in and removed the if((isset($_POST[‘msg’]), which effectively removes the need for the script to run based off of the AJAX call, allowing me to access the file directly, which I did. I also replaced the $_POST[‘msg’] with a static string. New code looks like this:
require 'library/tmhOAuth.php';
require 'library/tmhUtilities.php';
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => 'fSNOwKkG8KgU8pGNgt6w',
'consumer_secret' => 'xxxx',
'user_token' => '235311523-hn0wg0Qa3gv61dd0TuThSc5dsLTYNiUNHdfmjCkB',
'user_secret' => 'xxxx'
));
//echo "Authorization Message: $tmhOAuth<br/>";
$image = 'images/cancel.png';
$tweetmsg = "This is a test tweet";
$response = $tmhOAuth->request('POST', 'https://upload.twitter.com/1/statuses/update_with_media.json', array('media[]' => "@{$image}",'status' => "This is a status"), true, true);
echo "The response is: $response<br/><br/>";
if($tmhOAuth) {
echo $response;
} else {
echo "Your message has not been sent to Twitter.";
}
When i visit that page, I’m still getting a returned value of 0. I looked at the error code definitions, and there isn’t even a 0 listed. Can’t quite figure out where to go from here.
I saw something that said that these scripts aren’t necessarily meant to be accessed by a webpage, and need to be run by a server. If that is the case, how do I do that?