note 41648 added to function.fsockopen
| From: | SA at ititem dot net | Date: | Sun, 18 Apr 2004 07:05:18 +0000 |
| Subject: | note 41648 added to function.fsockopen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68282@lists.php.net to get a copy of this message | ||
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;
}
----
Manual Page -- http://www.php.net/manual/en/function.fsockopen.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41648
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41648&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41648&report=yes
Search -- http://master.php.net/manage/user-notes.php