From: sanry at now dot net dot cn
Operating system: redhat8
PHP version: 4.3.2
PHP Bug Type: Filesystem function related
Bug description: fgets fread can't read long date in fsockopen
Description:
------------
fgets fread can't read long date in fsockopen
php4.3.2 ever can't use any remote file function
php4.3.1 everything is okay
whatever $len is set , it can't read any long date
but everything is okay in php4.3.1 or older
there are so many big problem with remote file function
in php4.3.2 .
I post this bug for twice , I am not kitting .
function remote_request($host,
$path,$port=80,$method="GET",$len=2048,$user="",$pass="") {
$agent="Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)";
$fp = fsockopen($host,$port,$errno, $errstr, 6);
socket_set_timeout($fp, 18);
if (!$fp) {
echo "$err_msg ($err_num)<br>\n";
} else {
$auth = $user.":".$pass ;
$string=base64_encode($auth);
fputs($fp,"$method $path HTTP/1.1 \r\n");
fputs($fp,"Host: $host \r\n");
fputs($fp,"Accept-Language: zh-cn \r\n");
//fputs($fp,"charset=GBK");
if($pass)fputs($fp, "Authorization: Basic
".$string."\r\n");
fputs($fp, "User-Agent: ".$agent."\r\n");
if($pass)fputs($fp, "Content-type:
application/x-www-form-urlencoded \r\n");
//fputs($fp, "Cache-Control: no-cache\r\n");
fputs($fp, "Connection: close\r\n");
fputs($fp, "\r\n");
$reply=fread($fp,$len);
fclose($fp);
}
return $reply;
}
--
Edit bug report at http://bugs.php.net/?id=24376&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24376&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=24376&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24376&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24376&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24376&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24376&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24376&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24376&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24376&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24376&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24376&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24376&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24376&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24376&r=gnused