Fonction PHP pour envoyer un DM ( Direct Message ) Sur Twitter
function envoyer_dm_twitter($destinataire, $message, $login, $mot_de_passe)
{
define('POSTURL', "http://$login:$mot_de_passe@twitter.com/direct_messages/new.json");
define('POSTVARS', "user=$destinataire&text=$message");
$ch = curl_init(POSTURL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, POSTVARS);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_exec($ch);
}
Utilisation:
envoyer_dm_twitter("identifiant twitter du destinataire", "Votre message", "votre login", "votre mot de passe");
Plus d’info sur CURL ICI
Les Commentaires