title: How to Tweet in Twitter using PHP
body: <p>How can I tweet in twitter from my website? I am using a PHP script. Whatever tweets I send from my website should update my twitter account. I use the following code, but it is not updating in my twitter account:</p>
  
  <pre><code>// Set username and password
  $username='myusername';
  $password='*********';
  // The message you want to send
  $message = 'Nice to c all again.Have a nice day..';
  // The twitter API address
  $url='http://twitter.com/statuses/update.xml';
  // Alternative JSON version
  // $url = 'http://twitter.com/statuses/update.json';
  // Set up and execute the curl process
  $curl_handle = curl_init();
  curl_setopt($curl_handle, CURLOPT_URL, $url);
  curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
  curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl_handle, CURLOPT_POST,1);
  curl_setopt($curl_handle, CURLOPT_POSTFIELDS,"status=".$message);
  curl_setopt($curl_handle, CURLOPT_USERPWD,"$username:$password");
  $buffer = curl_exec($curl_handle);
  curl_close($curl_handle);
  // check for success or failure
  if (empty($buffer)) {
      echo 'Try again';
  } else {
      echo 'success';
  }
  </code></pre>
  
  <p>This script is returning a success message, but when I check my twitter account no tweets are found.</p>
  
  <p>What could be the problem?</p>