Use PHP and Jabber to send RSS feeds to your instant messaging application.
Instant messaging is ubiquitous. Some studies have shown that younger Internet users rely more on IM than on email. Unfortunately, because of the proprietary nature of the most popular IM systems and the stateless connections of HTTP, IM hasn't been easily integrated into PHP applications.
The Jabber open source protocol, developed by Jeremie Miller in
1998 (and now called the Extensible Messaging and Presence Protocol [XMPP]), is a native XML streaming protocol and
IETF-approved Internet standard for presence and messaging technologies.
Important to us, though, is that XMPP allows for PHP scripts to access
IM applications. This hack creates a command-line PHP Jabber client that uses the freely
class.jabber.php as a bridge to the XMPP
Another popular XML protocol called RSS allows a site to syndicate its content as a feed. Newsreaders and web pages poll a feed URL periodically, looking for new content items. The Jabber client we create will poll some existing weather RSS feeds for a new weather alert and send that alert off as an instant message.
Save the code in Example 9-7 as client.php.
Example 9-7. A Jabber client example
<?php /* CONFIG VARIABLES */ // jabber server you are registed at $SERVER =
'yourserver'; //username and password for your special account $USERNAME =
'yourusername'; $PASSWORD =
'yourpassword'; // jabber ...