function vc_doTwitterAPIPost($twit, $twitterURI) { //check if user login details have been entered on admin page $thisLoginDetails = get_option('twitterlogin_encrypted'); if($thisLoginDetails != '') { //this code based on http://www.morethanseven.net/posts/posting-to-twitter-using-php/ // list($username,$password) = split(":",base64_decode($thisLoginDetails)); $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, "$twit"); curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password"); $buffer = curl_exec($curl_handle); curl_close($curl_handle); return ''; } else { //user has not entered details.. Do nothing? Don't wanna mess up the post saving.. return ''; } }