Enviar post a Twitter con PHP
mayo 9, 2010 | 1 Comentario | Php Posteado pordementexmaster
Esta es una funcion muy util para los webmaster twitteros ya que pueden manda un post desde su web directamente a su twitter indicando su usuario contraseña y su mensaje, la interfaz de como lo hagan ya depende de ustedes saludos y espero que les sirva esta funcion:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | function tweet($message, $username, $password) { $context = stream_context_create(array( 'http' => array( 'method' => 'POST', 'header' => sprintf("Authorization: Basic %s\r\n", base64_encode($username.':'.$password)). "Content-type: application/x-www-form-urlencoded\r\n", 'content' => http_build_query(array('status' => $message)), 'timeout' => 5, ), )); $ret = file_get_contents('http://twitter.com/statuses/update.xml', false, $context); return false !== $ret; } |





