Pour poster efficacement un article sur twitter avec curl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function twitter($msg) { $username = 'utilisateur'; $password = 'motdepasse'; $url = 'http://twitter.com/statuses/update.xml'; $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=$msg"); curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password"); $buffer = curl_exec($curl_handle); curl_close($curl_handle); } |