Update Twitter From Your Website (HTML form)
Here is a small script that allows you to post updates to twitter from a simple HTML form on your website.
First thing you need is the form, this is a simple HTML form, very easy to add to your existing website:
<form name="form1" method="post" action="twitter.php">
Now for the script, just copy and paste this code into a blank document and save as twitter.php, you can name it what you want just remember to change the form action variable:
$username = ($_POST['t_user']);
$password = ($_POST['t_pass']);
$message = ($_POST['t_update']);
$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=$message");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
if (empty($buffer)) {
echo 'message';
} else {
echo 'success';
}
And that is it, if you want to set the username and password then all you need to do is change:
$username = ($_POST['t_user']); $password = ($_POST['t_pass']); // to $username = 'yourusername'; $password = 'yourpassword';
|
|
download: Web To Twitter (957B) added: 24/10/2009 clicks: 137 description: Post updates to Twitter from your website (Script) |
Subscribe
Join our mailing list
After building website's for many years I have decided to change my business model and the way that I deliver my service, Over the years I have made hundreds of PHP scripts, website templates and website's and have found that I am getting more and more people ask for the same project types over and over again so now I am about to release all of my scripts, most will be free and some of them will be for a small fee nothing like other website's are charging.
All you need to do is subscribe and I will let you know when scripts become avaliable, some will come included with Master Resale Rights!
You may un-subscribe at any time if you feel that you no longer need my free PHP scripts, cheap scripts, tips, tricks, and strategies on how to make your website profitable
Subscription
Fill out the form below to signup to our blog newsletter and we'll drop you a line when new articles come up.
Our strict privacy policy keeps your email address 100% safe & secure.

