IMified : Make your very own BOT (YIM-AIM-Gtalk-Jabber)


imified
Do you get invites from unknown IDs who asks you to chat. Especially in Yahoo messenger. You see that whenever you type hi/hello/how are you.. the other side almost immediately replies in a pattern. And most of us can immediately sense that its a BOT at the other side.

So what is a BOT?

Its just short for roBOT, we know what that is. Bots are actually automated scripts to work just like human beings(in our case non human being chatterbox).

Now, I’m gonna write about an easy and fun to do ChatterBox with the favor from IMified.com and Hasin Hayder. IMified lets you use their API to use with Yahoo or Aol or Gtalk/Jabber id. That means you can make your Yahoo ID or AIM ID or Gmail ID powered with a BOT script.😀

Hasin Hayder made it simpler for us (noob developers) by writing an easy to use wrapper class for the IMified API funtionality. And he released it under BSD license, so anyone can use that for free for any purposes (can use it anywhere-do whatever u want, derive new class from it without mentioning credit)
My friend Ferdous has implemented the IMified API wrapper class with the lastRSS.php class. Now, I’m here to show an example of using Daily horoscope with your BOT. Isn’t that funny?

You’ll just type Sagittarius and hit enter… and it will tell tell your today’s Zodiac reading of the day. You can implement the idea for million other purposes. So add my bot zodiac@bot.im to your gtalk/jabber account and enjoy!

< ?php
include "class.imified.php";

if(!isset($_REQUEST&#91;'msg'&#93;))
{
    echo "Lenin's bot zodiac@bot.im to demonstrate the imified API - please add this bot from your gtalk/jabber client. Visit my personal blog at <a href='https://lenin9l.wordpress.com'>Wordpress.com";
    die();
}
//initiate
$im = new ImifiedHelper("7FF693E6-B7EC-58F9-E621A3960144C21B","USERNAME","ahem!PASSWORDHERE!ahem");
//callback
$im->setCallback("callback");
function callback($message, $step, $network, $userKey)
{
    global $im;
if("Leo"==$message ||"Aries"==$message || "Virgo"==$message || "Libra"==$message ||"Scorpio"==$message ||"Sagittarius"==$message ||	"Capricorn"==$message ||"Pisces"==$message ||"Aquarius"==$message ||"Taurus"==$message ||"Gemini"==$message ||"Cancer"==$message ){
            //start
            include "lastRSS.php";
            // Create lastRSS object
            $rss = new lastRSS;
            // Set cache dir(chmod-ed 0777) and cache time limit (1200 seconds)
            $rss->cache_dir = './temp';
            $rss->cache_time = 1200;
            $rss->cp = 'UTF-8';
            $rss->date_format = 'l';
            // Try to load and parse RSS file of Slashdot.org
            $rssurl = 'http://www.astrocenter.com/us/Feeds/RSS/getDaily.aspx?sign='.$message;
            $rs = $rss->get($rssurl);
            if ($rs) {
                echo "Zodiac reading for today Dear ".$message."<br />";
                echo $rs['items'][0]['title']."<br />";
                echo $description = strip_tags(htmlspecialchars_decode($rs['items'][0]['description']))."<br />";
            }
            else {
                echo "Error: It's not possible to get $rssurl...";
            }
        //end
        $im->resetStep();
    }
    else{
        echo "Please type \"help\" to see available commands..<br />";
        $im->resetStep();
    }
}
?>

Acknowledgements : IMified.com, Hasin Hayder

8 thoughts on “IMified : Make your very own BOT (YIM-AIM-Gtalk-Jabber)

    • Thanks Hasin bhai, correction done!

      Now i can check out my horoscope easier than ever.

      শৈবাল দীঘিরে বলে উচ্চ করি শির
      লিখে রেখো এক ফোঁটা দিলেম শিশির 😉

  1. Pingback: IMified TwitterBOT (Jabbar/Gtalk/Yahoo/MSN/AOL) « el NiNo

  2. Pingback: 2010 in review « el NiNo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s