// activate full error reporting //error_reporting(E_ALL & E_STRICT); include 'XMPPHP/BOSH.php'; print "<pre>"; #Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports #If this doesn't work, are you running 64-bit PHP with < 5.2.6? $conn = new XMPPHP_BOSH('server.fwends.co.uk', 5280, '*****@*****.**', 'X;9T*WeG8yHH', 'xmpphp', 'server.fwends.co.uk', $printlog = true, $loglevel = XMPPHP_Log::LEVEL_VERBOSE); $conn->autoSubscribe(); try { if (isset($_SESSION['messages'])) { foreach ($_SESSION['messages'] as $msg) { print $msg; flush(); } } $conn->connect('http://server.fwends.co.uk/xmpp-httpbind', 1, true); #while(true) { $payloads = $conn->processUntil(array('message', 'presence', 'end_stream', 'session_start')); foreach ($payloads as $event) { $pl = $event[1]; switch ($event[0]) { case 'message': if (!isset($_SESSION['messages'])) { $_SESSION['message'] = array(); } $msg = "---------------------------------------------------------------------------------\n{$pl['from']}: {$pl['body']}\n"; print $msg; $_SESSION['messages'][] = $msg; flush(); $conn->message($pl['from'], $body = "Thanks for sending me \"{$pl['body']}\".", $type = $pl['type']); if ($pl['body'] == 'quit') {
<?php // activate full error reporting //error_reporting(E_ALL & E_STRICT); include 'XMPPHP/BOSH.php'; #Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports #If this doesn't work, are you running 64-bit PHP with < 5.2.6? $conn = new XMPPHP_BOSH('server.tld', 5280, 'username', 'password', 'xmpphp', 'server.tld', $printlog = true, $loglevel = XMPPHP_Log::LEVEL_VERBOSE); $conn->autoSubscribe(); try { $conn->connect('http://server.tld:5280/xmpp-httpbind'); while (!$conn->isDisconnected()) { $payloads = $conn->processUntil(array('message', 'presence', 'end_stream', 'session_start')); foreach ($payloads as $event) { $pl = $event[1]; switch ($event[0]) { case 'message': print "---------------------------------------------------------------------------------\n"; print "Message from: {$pl['from']}\n"; if ($pl['subject']) { print "Subject: {$pl['subject']}\n"; } print $pl['body'] . "\n"; print "---------------------------------------------------------------------------------\n"; $conn->message($pl['from'], $body = "Thanks for sending me \"{$pl['body']}\".", $type = $pl['type']); if ($pl['body'] == 'quit') { $conn->disconnect(); } if ($pl['body'] == 'break') { $conn->send("</end>"); }
// activate full error reporting //error_reporting(E_ALL & E_STRICT); include 'XMPPHP/BOSH.php'; print "<pre>"; #Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports #If this doesn't work, are you running 64-bit PHP with < 5.2.6? $conn = new XMPPHP_BOSH('talk.google.com', 5222, 'spottersu', 'spotGSP11', 'xmpphp', 'gmail.com', $printlog = true, $loglevel = XMPPHP_Log::LEVEL_INFO); $conn->autoSubscribe(); try { if (isset($_SESSION['messages'])) { foreach ($_SESSION['messages'] as $msg) { print $msg; flush(); } } $conn->connect('http://talk.google.com:5222/xmpp-httpbind', 1, true); #while(true) { $payloads = $conn->processUntil(array('message', 'presence', 'end_stream', 'session_start')); foreach ($payloads as $event) { $pl = $event[1]; switch ($event[0]) { case 'message': if (!isset($_SESSION['messages'])) { $_SESSION['message'] = array(); } $msg = "---------------------------------------------------------------------------------\n{$pl['from']}: {$pl['body']}\n"; print $msg; $_SESSION['messages'][] = $msg; flush(); $conn->message($pl['from'], $body = "Thanks for sending me \"{$pl['body']}\".", $type = $pl['type']); if ($pl['body'] == 'quit') {