按照XMPPHP官方的例子
<?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('[email protected]', 'This is a test message!'); $conn->disconnect(); ?>此段PHP代碼執行後,顯示的可能是 no error messages, no warnings , everything says the message has been sent.
但是服務器實際上沒有收到。 一種可能的原因是由於加密導致的,因此要關閉加密:
$conn->useEncryption(false);
加入此行代碼後即可成功發送消息