Recently I made a news bot named news@bot.im AKA newsbot24@yahoo.com with the help of a wrapper class wrote by Hasin Hayder. This cool API has been provided by imified recently to make your application IM enable easily . You may test my bot by sending any instant message to newsbot24@yahoo.com or sending a message from your GTalk. It will grab one of the latest 25 top news from www.news.google.com or www.bdnews24.com RSS feed. I have set caching time as 1200 so that it can be easily work with very less bandwidth. I used lastRSS class to grab the RSS feed as I am having some freight to use Google feed parser with JSON ![]()
You can make one just for FREE from www.bot.im All you need is to DOWNLOAD the wrapper class to do it quick. Alternatively you may read the quick and dirty documentation from HERE.
Now lemme reveal the source code I used for my news bot :p
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | <?php // include lastRSS include "lastRSS.php"; include "class.imified.php"; // Set cache dir and cache time limit (1200 seconds) // (don't forget to chmod cahce dir to 777 to allow writing) $rss->cache_dir = './temp'; $rss->cache_time = 1200; $rss->cp = 'UTF-8'; $rss->date_format = 'l'; //initiating bot... //@param pass your imified user credentials $im = new ImifiedHelper("YOUR-API-KEY-GIVEN-FROM-IMIFIED","DEVELOPERS-NAME","PASSWORD"); if(!isset($_REQUEST['msg'])) { echo "This is a newsbot. You may add it as news@bot.im or newsbot24@yahoo.com"; die(); } //callback $im->setCallback("callback"); function callback($message, $step, $network, $userKey) { global $im; $message = strtolower($message); if("inews" == $message){ // Create lastRSS object $rss = new lastRSS; // Try to load and parse RSS file of Slashdot.org $rssurl = 'http://news.google.com/?output=rss'; $rs = $rss->get($rssurl); if ($rs) { $i = rand(0,25); echo $title = strip_tags(htmlspecialchars_decode($rs['items'][$i]['title']." "))." "; echo $description = strip_tags(htmlspecialchars_decode($rs['items'][$i]['description']))." "; } else { echo "Error: It's not possible to get $rssurl..."; } $im->resetStep(); } elseif("bdnews" == $message){ // Create lastRSS object $rss = new lastRSS; $rssurl = 'http://rss.bdnews24.com/rss/english/home/rss.xml'; $rs = $rss->get($rssurl); if ($rs) { $i = rand(0,25); echo $title = strip_tags(htmlspecialchars_decode($rs['items'][$i]['title']))." "; echo $description = strip_tags(htmlspecialchars_decode($rs['items'][$i]['description']))." "; } else { echo "Oops! Looks like Server is Busy! to get ".$rssurl." Give it a try with inews"; } } else{ echo "Please type help to see available commands"; $im->resetStep(); } } ?> |
Related Reading:
No related posts.
10 Responses to “Create your IM bot for gtalk/jabber/aim/yahoo with imified API”
Trackbacks/Pingbacks
- Laptop ….. . . . . . …. … . . . .. . . .. ..? | laptop computers blog - [...] Create your IM bot for gtalk/jabber/aim/yahoo with imified API … [...]







it was very interesting to read dynamicguy.com
I want to quote your post in my blog. It can?
And you et an account on Twitter?
sure you can! My twitter handle is @ferdous
I actually decided to create a short video about this, I would be appreciative if you could maybe take a moment to look it and perhaps leave a comment about what you think, I left the video link in the “website” field, hopefully you can access it, thanks greatly
Really great informative blog post here and I just wanted to comment & thank you for posting this. I’ve bookmarked youi blog and I’ll be back to read more in the future my friend! Also nice colors on the layout, it’s really easy on the eyes.
Really great informative blog post here and I just wanted to comment & thank you for posting this. I’ve bookmarked youi blog and I’ll be back to read more in the future my friend! Also nice colors on the layout, it’s really easy on the eyes.
Really amazing and informative blog post here. I just wanted to comment & thank you for posting this. I’ve bookmarked youi blog and I’ll be back to read more in the future my friend! Also nice colors on the layout, it’s really easy on the eyes.
I would like to thank you for your efforts you have made in making this blog post. I am hoping the same best work from you in the future too. In fact your great writing abilities has helped me to start my own blog. Really the blogging is spreading its wings wide. Your blog post is a fine example of it.
I would like to exchange links with your site dynamicguy.com
Is this possible?
sure
I’m impressed!! Really informative blog post here my friend. I just wanted to comment & say keep up the quality work. I’ve bookmarked your blog just now and I’ll be back to read more in the future my friend! Also nice colors on the layout, it’s really easy on the eyes.