/ Published in: PHP
URL: http://www.bradshawenterprises.com/blog/2009/how-to-use-twitter-as-an-error-log/
Expand |
Embed | Plain Text
function tweet_error ($error, $description) { $username = 'yourusername'; $password = 'yourpassword'; $status = "#$error - $description"; $update_url = 'http://www.twitter.com/statuses/update.xml'; // http://identi.ca/api/statuses/update.xml will use identi.ca instead. $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "$update_url"); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, "status=$status"); curl_setopt($curl, CURLOPT_USERPWD, "$username:$password"); $result = curl_exec($curl); $resultArray = curl_getinfo($curl); curl_close($curl); return ($resultArray['http_code'] == 200); }
You need to login to post a comment.
