0
<?php
include("XMPP.php");

$conn = new XMPPHP_XMPP('server.com', 5222, 'user', 'pass', 'home');
$conn->useEncryption(true);
$conn->connect();
$conn->processUntil('session_start');
$conn->message('person@server.com', mktime());
$payloads = $conn->processUntil('message');
$conn->message('person@server.com', mktime());
$conn->disconnect();
?>

Right... so it connects - it starts the session and sends the first timestamp which is received on the jabber client I'm using.

Then its supposed to "processUntil" a message is received (afaik) and if a message is received send another timestamp. Well, this bit is the bit that doesn't work.

I have no prior knowledge of XMPP servers or XMPPHP, so all help, however basic, wouldn't go unappreciated! :)

Thanks.

Thomas Clayson
  • 29,657
  • 26
  • 147
  • 224
  • Try passing in the last few logging options for `new XMPPHP_XMPHP` ie `$xmpphp = new XMPPHP_XMPP( $server_settings["address"], 5222, $xmpp_settings["username"], $xmpp_settings["password"], $resource, NULL, TRUE, XMPPHP_Log::LEVEL_VERBOSE );` – Kendall Hopkins Dec 02 '10 at 18:04
  • that just gives me a huge page of information that doesn't really help me :p – Thomas Clayson Dec 03 '10 at 09:48
  • I am not sure why you can't get this simple app working with xmpphp library... nevertheless if you are still looking for a solution contact library author directly else try out other xmpp libraries in PHP e.g. Jaxl library http://github.com/abhinavsingh/JAXL – Abhinav Singh Dec 14 '10 at 18:55

2 Answers2

1

I fought with this for a while. Turns out that you have to announce your presence when you connect. I extracted this from the cli_longrun_example.php and put it after my $conn->connect() and $conn->processUntil('session_start') calls:

$conn->presence($status='Controller available.');
1

you can recive first message in your jabber client. with

$conn->message('person@server.com', mktime());

but then you are recive message from server with

   $payloads = $conn->processUntil('message');

but you cant recive message with that.

and scrpit cant load haead so you cant receive another message. i have a same problem. you can use jaxl for that.

Maulik Kanani
  • 642
  • 6
  • 22