0
$fp = stream_socket_client("tcp://chat.facebook.com:5222", $errno, $errstr, 20);
fwrite($fp, '<stream:stream to="chat.facebook.com" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0" />' . PHP_EOL);
$temp1 = fgets($fp);
fwrite($fp, '<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="X-FACEBOOK-PLATFORM"></auth>');
$temp2 = fgets($fp);
fclose($fp);
die(var_dump($temp1, $temp2));
是什麼導致$ temp2 false
的結果?PHP stream_socket_client和facebook chat
string(365) "<?xml version="1.0"?><stream:stream id="247B12CF" from="chat.facebook.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0" xml:lang="en"><stream:features><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features></stream:stream>"
bool(false)