My team and I are struggling to put together a notification software to incorporate onto our site, so that users who have added our bot on their IM client (eg. MSN, AIM, Yahoo Messenger) would be able to get alerted when something relevant is relating to them. We'd also need to be able to check to see what their status is (online, offline, busy).
Do you know if this could be done with straight PHP, or what other language would need to 开发者_高级运维come into play to make something like this possible?
Thanks! Donny
... not sure if I understood you correctly: Do you have already a IM-Bot running? If so, it should provide you the necessary API to get your work done (have a look at the documentation of the bot you are using.)
In case you are actually looking for a bot that may be run on MSN/AIM/Yahoo/etc. I'd recommend to have a look on Bitlbee which is a IRC server that may connect to IM networks. With help of Net_SmartIRC Package from PHP pear you'll be able to connect to it and gather the information you need. Hope that helps.
I'd recommend taking a look at node.js for this. But if you want to stick with PHP on the server side JavaScript polling would be the easiest way to incorporate this.
Example JavaScript with some help from jQuery:
setInterval(function(){
$.ajax({
url: "your_script.php",
success: function(data){
// process the data returned from the PHP script
}
});
}, 2000);
This would request "your_script.php", wait two seconds and request again.
精彩评论