public static function sendBody($xml, $jaxl) { $xml = JAXLPlugin::execute('jaxl_pre_curl', $xml, $jaxl); if ($xml != false) { JAXLog::log("[[XMPPSend]] body\n" . $xml, 4, $jaxl); $payload = JAXLUtil::curl($jaxl->bosh['url'], 'POST', $jaxl->bosh['headers'], $xml); $payload = $payload['content']; XMPPGet::handler($payload, $jaxl); } return $xml; }
function getXML($nap = TRUE) { // sleep between two reads if ($nap) { sleep(JAXL_XMPP_GET_SLEEP); } // initialize empty lines read $emptyLine = 0; // read previous buffer $payload = $this->buffer; $this->buffer = ''; // read socket data for ($i = 0; $i < JAXL_XMPP_GET_PCKTS; $i++) { if ($this->stream) { $line = fread($this->stream, JAXL_XMPP_GET_PCKT_SIZE); if (strlen($line) == 0) { $emptyLine++; if ($emptyLine > JAXL_XMPP_GET_EMPTY_LINES) { break; } } else { $payload .= $line; } } } // trim read data $payload = trim($payload); $payload = JAXLPlugin::execute('jaxl_get_xml', $payload, $this); if ($payload != '') { XMPPGet::handler($payload, $this); } }