Hi all,
I'm currently coding a sockets based client which talks to a remote server. I've used the same code I've used for another project but with this one I have no control over the data sent by the remote side.
The problem is with the code I've used, it only seems to retain the last line in the data. I'm expecting it to send me back
=====================
200 OK
.
=====================
But with the following code:
function _Read() {
$buf_reading = true;
$str_buffer = "";
$str_data = "";
while(($str_buffer = socket_read($this->socket, 1024, PHP_NORMAL_READ)) !== false) {
$str_data .= $str_buffer;
if(preg_match("'\r\n$'s", $str_data)) {
break;
};
};
unset($buf_reading);
unset($str_buffer);
return trim($str_data);
}
all I get back in the return of the function is ".". I would appreciate any help! Running on PHP 5.0.0RC2.