php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1241 fgets and fgetss don't work
Submitted: 1999-03-17 08:47 UTC Modified: 1999-06-01 15:50 UTC
From: empgmma at brunel dot ac dot uk Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.7 OS: Linux (Redhat 5.2)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: empgmma at brunel dot ac dot uk
New email:
PHP Version: OS:

 

 [1999-03-17 08:47 UTC] empgmma at brunel dot ac dot uk
I am trying to download a file and strip the HTML code from it. I tried a straight fgetss after fopen and it returned an empty string. So I tried caching the file and that didn't work either.

Another thing, I think it would be a good idea to allow openning wrappers through a proxy server. The service ports are blocked on my machine and everything has to go through a proxy server!

Failing that.. what commands do I need to type if I open a socket with my proxy server (for downloading an HTML file)


<FORM ACTION="<?echo $PHP_SELF?>" METHOD="POST">
<p>ENTER URL:<INPUT TYPE="text" NAME="url" value="http://">
<input type=submit value="Convert">
<input type=reset>
<?
        if (isset($url)){
                $text = file($url);
                $size = sizeof($text);
                $name = tempnam("/home/httpd/html/temp", "dnload");
                $fp = fopen($name, "w");
                if (!fp){
                        echo "error, Cannot open $name<br>";
                }else{
                        for ($x = 0; $x < $size; $x++){
                                echo $text[$x];
                                fwrite($fp, $text[$x]);
                        }

                        rewind($fp);                        $size = filesize($name);
                        echo "size = $size<br>";
                        $text2 = fgetss($fp, $size);
                        echo "text = \"$text2\"";
                        fclose($fp);
                        unlink($name);
                }
        }
?>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-01 15:50 UTC] jim at cvs dot php dot net
Keep in mind that fgets() and fgetss() only read a
line at a time. They both work fine.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Jun 29 08:00:02 2026 UTC