|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24376 fgets fread can't read long date in fsockopen
Submitted: 2003-06-28 12:54 UTC Modified: 2003-06-28 13:00 UTC
From: sanry at now dot net dot cn Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.2 OS: redhat8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sanry at now dot net dot cn
New email:
PHP Version: OS:


 [2003-06-28 12:54 UTC] sanry at now dot net dot cn
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 ;
                fputs($fp,"$method $path HTTP/1.1 \r\n");
                fputs($fp,"Host: $host \r\n");
        fputs($fp,"Accept-Language: zh-cn \r\n");
                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");
        return $reply;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-28 13:00 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Please read the documentation for fread():

Note: When reading from network streams or pipes, such as those returned when reading remote files or from popen() and proc_open(), reading will stop after a packet is available. This means that you should collect the data together in chunks as shown in the example below.

Your script worked in 4.3.1 because of a bug in that version.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Dec 02 04:01:24 2020 UTC