function twitter($user,$pass,$msg,$url){
$url = tinyurl($url);
$msg = $msg."-".$url;
$header = "POST http://twitter.com/statuses/update.json HTTP/1.1\r\n";
$header .= "Host: twitter.com\r\n";
$header .= "Authorization: Basic ".base64_encode ($user.":".$pass)."\r\n";
$header .= "Content-type: application/x-www-form-urlencoded\r\n";
$header .= "Content-length: ".strlen ("status=$msg")."\r\n";
$header .= "Connection: Close\r\n\r\n";
$header .= "status=$msg";
$fp = fsockopen ("twitter.com", 80);
fwrite($fp, $header);
fclose($fp);
}
//USAR A FUNCAO
twitter('username','password','Isto é um teste','http://www.sapovideo.com/1736334/contemporneos--o-amigo-gay/');
Faltou a do tinyurl
function tinyurl($url){
$url = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
return $url;
}