按照XMPPHP官方的例子
此段PHP代码执行后,显示的可能是 no error messages, no warnings , everything says the message has been sent.
<?php include("xmpp.php"); $conn = new XMPP('talk.google.com', 5222, 'username', 'password', 'xmpphp', 'gmail.com', $printlog=False, XMPPHP_Log::LEVEL_VERBOSE); $conn->connect(); $conn->processUntil('session_start'); $conn->message('someguy@someserver.net', 'This is a test message!'); $conn->disconnect(); ?>
但是服务器实际上没有收到。 一种可能的原因是由于加密导致的,因此要关闭加密:
$conn->useEncryption(false);
加入此行代码后即可成功发送消息