title: Twitter API OAuth PHP post_tweet.php
body: <p>I'm unable to get any results following to post a tweet from php. I've registered my app with twitter and got my credentials. I've made a page called access_tokens.php, and downloaded an OAuth library called tmhOAuth.php. I'm following an example tutorial exactly, and nothing seems to be appearing - is there any help that can be offered?</p>
  
  <p>access_tokens.php </p>
  
  <pre><code>&lt;?php
  
  $consumer_key = 'xx';
  $consumer_secret = 'xx';
  $user_token = 'xx';
  $user_secret = 'xx';
  
  //xx is the replacement for my actual values
  
  ?&gt;
  </code></pre>
  
  <p>post_tweet.php</p>
  
  <pre><code>&lt;?php
  //Load the app's keys into memory
  require 'app_tokens.php';
  
  //Load the tmOAuth library
  require 'tmhOAuth.php';
  
  //Create an OAuth connection to the Twitter API
  $connection = new tmhOAut(array(
                              'consumer_key'   =&gt;     $consumer_key,
                              'consumer_secret'=&gt;     $consumer_secret,
                              'user_token'     =&gt;     $user_token,
                              'user_secret'    =&gt;     $user_secret
                              ));
  
  //Send a tweet
  $code = $connection -&gt; request('POST',
      $connection -&gt; url('1.1/statuses/update'),
      array('status' =&gt; 'Hello Twitter'));
  
  //A response code of 200 is a success
  if ($code == 200){
      print "Tweet sent";
  }
  else{
      print "Error:$code";
  }                               
  
  ?&gt;
  </code></pre>