Secure twitter API

Secure twitter API kann Statusmeldungen von ändern.


/* ---------------------------------------- */
// Change these parameters with your Twitter 
// user name and Twitter password.
/* ---------------------------------------- */
$twitter_username = 'username';
$twitter_psw = 'password';
//noch nicht integriert
$myself = 'twitter.php';
/* ---------------------------------------- */
/* Don't change the code belove
/* ---------------------------------------- */
	} else {
	$twitter_status=postToTwitter($twitter_username, $twitter_psw, $twitter_message);
/* ---------------------------------------- */
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Secure API v0.1</title>
<style type="text/css">
body{font-family:'Lucida Grande', Verdana, sans-serif;; font-size:14px; color:#666666;}
h3{color:#000000; font-size:14px;}
p{font-size:12px; color:#333333;}
input{font-size:18px; color:#444444;}
a:link, a:visited, a:hover{color:#0033CC;}
div.footer{padding:6px; border-top:solid 1px #DEDEDE; font-size:10px;}
div.msg{background:#FFFFCC; margin-bottom:10px; padding:4px;}
div.code{padding:10px; background:#FFFFCC; font-size:11px; color:#000000; margin-bottom:20px; width:300px; border:solid 1px #CCCCCC;}
<h2>Secure twitter API</h2>
<p>Status Nachricht eingeben:</p>
<!-- This is the form that you can reuse in your site -->
<?php if(isset($_POST['twitter_msg']) && !isset($error)){?>
<div class="msg"><?php echo $twitter_status ?></div>
<?php } else if(isset($error)){?>
<div class="msg">Error: please insert a message!</div>
<?php }?>
<p><strong>What are you doing?</strong></p>
<form action="twitter.php" method="post">
<input name="twitter_msg" type="text" id="twitter_msg" size="40" maxlength="140" />
<input type="submit" name="button" id="button" value="post" />
<!-- END -->
<div class="footer">
For info please visit <a href="">Secure twitter API</a> Original Code by: <a href=""></a>
<br />


// A simple function using Curl to post (GET) to Twitter
// Kosso : March 14 2007
function postToTwitter($username,$password,$message){
    $host = "".urlencode(stripslashes(urldecode($message)));
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $host);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
    curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
    $result = curl_exec($ch);
    // Look at the returned header
    $resultArray = curl_getinfo($ch);
    if($resultArray['http_code'] == "200"){
         $twitter_status='Your message has been sended! <a href="'.$username.'">See your profile</a>';
    } else {
         $twitter_status="Error posting to Twitter. Retry";
	return $twitter_status;
Cookies helfen bei der Bereitstellung von Inhalten. Durch die Nutzung dieser Seiten erklären Sie sich damit einverstanden, dass Cookies auf Ihrem Rechner gespeichert werden. Weitere Information
QR-Code Secure twitter API (erstellt für aktuelle Seite)