milardovich

Untitled

Jun 19th, 2011
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. function postToTwitter($username,$password,$message){
  2.     $host = "http://twitter.com/statuses/update.xml?status=";
  3.     $host.=urlencode(stripslashes(urldecode($message)));
  4.     $ch = curl_init();
  5.         curl_setopt($ch, CURLOPT_URL, $host);
  6.         curl_setopt($ch, CURLOPT_VERBOSE, 1);
  7.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  8.         curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
  9.         curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  10.         curl_setopt($ch, CURLOPT_POST, 1);
  11.     $result = curl_exec ($ch) or die('error');
  12.         $resultArray = curl_getinfo($ch);
  13.         curl_close($ch);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment