So for all of you twitters out there here is a little tutorial how to write your own IM bot to easily update twitter using IM client. I know i know you can use the official IM twitter bot BUT it is down right now. So, why not use your own.

First of all read post How to Write Your Own IM Bot in Less Than 5 Minutes

Follow all the steps and create your own bot.
Next add the following code to the .php script from the IM Bot blog post.

// Set username and password
$username = 'user';
$password = 'pass';
// The message you want to send
$message = $_REQUEST['msg'];
// The twitter API address
$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);
// check for success or failure
if (empty($buffer)) {
echo 'message';
} else {
echo 'success';
}



Thats it!
enjoy!

Views: 61

Comment

You need to be a member of Codetown to add comments!

Join Codetown

Comment by Zemian Deng on December 3, 2008 at 10:31pm
I don't use twitter, but it's a cool bot service by imified. Thanks for the link and sample script!

Happy 10th year, JCertif!

Notes

Welcome to Codetown!

Codetown is a social network. It's got blogs, forums, groups, personal pages and more! You might think of Codetown as a funky camper van with lots of compartments for your stuff and a great multimedia system, too! Best of all, Codetown has room for all of your friends.

When you create a profile for yourself you get a personal page automatically. That's where you can be creative and do your own thing. People who want to get to know you will click on your name or picture and…
Continue

Created by Michael Levin Dec 18, 2008 at 6:56pm. Last updated by Michael Levin May 4, 2018.

Looking for Jobs or Staff?

Check out the Codetown Jobs group.

 

Enjoy the site? Support Codetown with your donation.



InfoQ Reading List

Enhancing Developer Experience for Creating Artificial Intelligence Applications

For one company, large language models created a breakthrough in artificial intelligence (AI) by shifting to crafting prompts and utilizing APIs without a need for AI science expertise. To enhance developer experience and craft applications and tools, they defined and established principles around simplicity, immediate accessibility, security and quality, and cost efficiency.

By Ben Linders

Article: 9 Steps Towards an Agile Architecture

Just as a Minimum-Viable Architecture (MVA) approach does not create a system’s architecture in a single step, adopting an MVA approach takes a series of incremental steps as well. These organizational changes start with a single development team and use feedback to evolve the process as more teams are brought in.

By Kurt Bittner, Pierre Pureur

JetBrains IntelliJ IDEA 2024.1 Delivers Support for Java 22 Features

JetBrains released IntelliJ IDEA 2024.1 featuring support for Java 22 features, OpenRewrite, WireMock server, the Maven Shade Plugin and full line code completion for Java and Kotlin.

By Johan Janssen

Presentation: The Creative Act: How Staff+ Is More Art Than Science

David Grizzanti talks about his path to Staff+ and how he views it as more art than science, looking at the parallels between creating art, creating software, and dealing with organizational dynamics.

By David Grizzanti

Terraform 1.8 Adds Provider-Defined Functions, Improves AWS, GCP, and Kubernetes Providers

HashiCorp has released version 1.8 of Terraform, their infrastructure-as-code language. The release introduces provider-defined functions. This enables the creation of custom functions within a given provider that handle computational-style tasks. Several providers have introduced new provider-defined functions. Version 1.8 also introduces improvements to refactoring across resource types.

By Matt Campbell

© 2024   Created by Michael Levin.   Powered by

Badges  |  Report an Issue  |  Terms of Service