note 41648 deleted from function.fsockopen by irchtml
| From: | irchtml@php.net | Date: | Sun, 18 Apr 2004 07:06:30 +0000 |
| Subject: | note 41648 deleted from function.fsockopen by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-68283@lists.php.net to get a copy of this message | ||
Note Submitter: SA@ititem.net
----
Up to 4.3.4, following script did work just fine. The problem is after fputs in the sendCommand
function, feof will always return true and I can not get the result back.
Immediately switch back to 4.3.4 (from 4.3.5 or 4.3.6), this error disappear.
So, is there any change in 4.3.5/4.3.6 on fsockopen/fputs/fgets?
function connect () {
if (!($this->fp = fsockopen ($this->REG_HOST, $this->REG_PORT, $errno, $errstr,
180))) {
return 0;
}
$result = '';
for ($i = 0; (! feof ($this->fp)) && (! ereg ("</epp>$",
$result)) && ($i < 5000); $i++) {
$result .= fgets ($this->fp, 2);
}
return (ereg ("</greeting></epp>$", $result) ? 1 : 0);
}
/*************************
*/
function sendCommand ($cmd) {
fputs ($this->fp, $cmd);
$result = '';
for ($i = 0; (! feof ($this->fp)) && (! ereg ("</epp>$",
$result)) && ($i < 5000); $i++) {
$result .= fgets ($this->fp, 2);
}
return $result;
}