PHP – Twitter Auto Publish API

This example can be used to post the message to Twitter without using oAuth.
It can send requests to the Twitter site to authenticate on behalf of a given user and post updated
status messages.

Code Example: Download Example

<?php
session_start();
if(isset($_POST['uname'])){    
 error_reporting(E_ALL && ~E_NOTICE);
 require_once("openinviter_base.inc.php"); // Exist into attached .zip download example package
 require_once("twitter_auto_publish.inc.php"); // Exist into attached .zip download example package
 $user=trim($_POST['uname']);
 $pass=trim($_POST['password']);    
 $msg=trim($_POST['status']);

 $rochak=new twitter_auto_publish();

 $rochak->login($user,$pass);

 $rochak->updateTwitterStatus($msg);
 echo "SUCCESS!";
 echo "<h3>Following: </h3>".$rochak->getFollowings();
 echo "<h3>Followers: </h3>".$rochak->getFollowers();
 $rochak->logout();    
}
?>
<html>
<head>
<title>Twitter Auto Publish</title>
</head>
<body>
<h2>Twitter Auto Publish</h2>
<form action="#" method="post">
 <div>Twitter Username:
 <input type="text" name="uname" />
 </div>
 <div>Twitter Password:
 <input type="password" name="password" />
 </div>
 <div>Message:
 <input type="text" name="status" size="140" />
 </div>
 <div>
 <input type="submit" name="publish" value="Publish" />
 </div>
</form>
</body>
</html>

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

Leave a Comment

Your email address will not be published. Required fields are marked *