Send message to user from PHP


I want to send a message from a php script. Its no bot or anything. I just want to be able to push out a message from a phpscript to a user.

I have er user called server which is suppose to deliver all the messages.

I can connect from iChat to both of the accounts and send messages to eachother, so the server works.

I just cant seem to find a way to do this. I’ve tried with both xmpphp and jaxl but nothing happends.

This i a jaxl script i have. If i call it from cli and let it run, and send a message to server from my client user it replys, so it works if it is eventbased. But take a look at line 16 “$jaxl->sendMessage(“client@frisr.dkr”, “test message, hi”);” <-- this message is never delivered

<?php /* Include Key file */ include_once("config.ini.php"); /* Include JAXL Class */ include_once("jaxl.class.php"); /* Create an instance of XMPP Class */ $jaxl = new JAXL(); try { /* Initiate the connection */ $jaxl->connect(); $jaxl->sendMessage("client@frisr.dkr", "test message, hi"); /* Communicate with Jabber Server */ while($jaxl->isConnected) { $jaxl->getXML(); } //$jaxl->disconnect(); } catch(Exception $e) { die($e->getMessage()); } ?>

I also tried with xmpphp:

<?php include "XMPPHP/XMPP.php"; //username = user without domain, "user" and not "user@server" - home is the resource $conn = new XMPPHP_XMPP('', 5222, 'server', 'password', 'home'); // Enables TLS - enabled by default, call before connect()! $conn->useEncryption(false); $conn->connect(); $conn->processUntil('session_start'); $conn->message('', 'This is a test message!'); $conn->disconnect(); Anyone know how i can do it?


I don’t know jaxl but as far as I can tell: xmpphp didn’t work for me.

Maybe you should debug the send/receive XMLs you send/get to/from the server. The server should tell you what’s wrong

In the future I will probably release a tiny PHP-Lib to connect to the Openfire server. Implementing a sendMessage-Method wouldn’t be that much of a problem.

But I cannot tell when, because I need the permission to opensource it from my company.