22 require_once dirname(__FILE__).
'/../class.ilBMFBase.php';
60 $this->urlparts = @parse_url(
$url);
70 $this->socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
71 if ($this->socket < 0) {
76 $result = socket_connect($this->socket, $this->urlparts[
'host'],
77 $this->urlparts[
'port']);
94 function send($msg, $options = NULL)
96 $this->incoming_payload =
'';
97 $this->outgoing_payload = $msg;
103 if (strcasecmp($this->urlparts[
'scheme'],
'TCP') == 0) {
106 return $this->
_raiseSoapFault(
'Error connecting to ' . $this->url .
'; reason: ' . socket_strerror(socket_last_error($this->socket)));
110 if (!@socket_write($this->socket, $this->outgoing_payload,
111 strlen($this->outgoing_payload))) {
112 return $this->
_raiseSoapFault(
'Error sending data to ' . $this->url .
'; reason: ' . socket_strerror(socket_last_error($this->socket)));
116 if(!socket_shutdown($this->socket, 1)) {
121 while ($buf = @socket_read($this->socket, 1024, PHP_BINARY_READ)) {
122 $this->incoming_payload .= $buf;
126 if ($this->incoming_payload) {
130 return $this->
_raiseSoapFault(
'Error reveiving data from ' . $this->url);
144 if (!is_array($this->urlparts) ) {
148 if (!isset($this->urlparts[
'host'])) {
152 if (!isset($this->urlparts[
'path']) || !$this->urlparts[
'path']) {
153 $this->urlparts[
'path'] =
'/';