tags:

views:

411

answers:

3

As the title says, i want to send the same message to multiple recipients. I use the PHP library XMPPHP and send single messages with this:

<?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();
?>

I try it with a loop of this:

$conn->message('[email protected]', 'This is a test message!');

Or a loop with the complete code. But nothing happens...

Best regards,

Hannes

A: 

Maybe you need to destroy $conn after your disconnect(); before you use it again if its in a loop?

Or give each $conn a unique name?

ian
+1  A: 

I would use the $conn->message('[email protected]', 'This is a test message!'); line in the loop.

The code before this line makes the connection and waits for the xmpp session starting.

The code after this line makes the disconnection.

Ifju
A: 

Make sure that [email protected] (the person you are sending to) has [email protected] (the account you are sending from) added as a friend.

Tom