tags:

views:

1759

answers:

2

Hi, I was wondering how to create a chat bot for Google Talk via special client.

I know it uses XMPP to send messages, but I do not know how to use this at all. It is my understanding that I should be able to make a bot which chats for me when I am away if I were to create my own client page, which would parse the chats with my data. Where would I begin if I wanted to create a custom client, and how could I make it parse messages and autorespond in a set manner? My intended usage: autoresponder for when I am AFK, with a decent AI (which I can make.)

Can I use this protocol with PHP to make my bot, or must it be java or python based?

Thanks for any and all help!!!

+4  A: 

The xmpphp library should help you. Have a look at the examples.

PHP is absolutely the last language I would use for something like this (well, okay, I wouldn't do it in awk or sed either), but if you're set on using it, you can.

Meredith L. Patterson
Awesome!I am set on using php. It will be much easier for me in the long run.
Cyclone
+1 for not using PHP - PHP Dev.
Unkwntech
+1  A: 

Give a look to this library:

Gives you a fully OOP API (> PHP5) to communicate using this protocol.

By default it uses TLS so you will not have any problems connecting to the talk google server.

Check this code example:

<?php
include("xmpp.php");
$conn = new XMPP('talk.google.com', 5222, 'username', 'password', 'xmpphp',
                 'gmail.com', $printlog=False, $loglevel=LOGGING_INFO);
$conn->connect();
$conn->processUntil('session_start');
$conn->message('[email protected]', 'This is a test message!');
$conn->disconnect();
?>
CMS
What is TLS? Does my web server need to support it, or is that only needed by the gmail server?
Cyclone
Transport Layer Security (http://is.gd/1ZOkz) is a secure communication protocol, the Google Talk servers wrap the XMMP sessions under this protocol, so all the messaging and the entire session, travels encrypted on the network. Your PHP instalation must have OpenSSL support (http://is.gd/1ZPOD)
CMS