function client(&$data) { $attachments = array(); /* If neither matches, we'll just try it anyway. */ if (stristr($data, 'Content-Type: application/dime')) { $this->_decodeDIMEMessage($data, $this->headers, $attachments); } elseif (stristr($data, 'MIME-Version:')) { /* This is a mime message, let's decode it. */ $this->_decodeMimeMessage($data, $this->headers, $attachments); } else { /* The old fallback, but decodeMimeMessage handles things fine. */ $this->_parseEmail($data); } /* Get the character encoding of the incoming request treat incoming * data as UTF-8 if no encoding set. */ if (!$this->soapfault && !$this->_getContentEncoding($this->headers['content-type'])) { $this->xml_encoding = SOAP_DEFAULT_ENCODING; /* An encoding we don't understand, return a fault. */ $this->_raiseSoapFault('Unsupported encoding, use one of ISO-8859-1, US-ASCII, UTF-8', '', '', 'Server'); } if ($this->soapfault) { return $this->soapfault->getFault(); } $client = new SOAP_Client(null); return $client->parseResponse($data, $this->xml_encoding, $this->attachments); }