ID: 22937 Updated by: [EMAIL PROTECTED] Reported By: freddie at bingham dot net -Status: Open +Status: Feedback Bug Type: Sockets related Operating System: Redhat 7.3 PHP Version: 4.3.2 New Comment:
dunkel at calamus dot net: fopen will raise a warning if it could not open the file. That is how it works. To hide the warning, use the @ operator. freddie at bingham dot net: please try this little script: $p = fopen('http://pub133.ezboard.com/bonesixthwarriors', 'rb'); var_dump($http_response_headers); and paste the result here Previous Comments: ------------------------------------------------------------------------ [2003-06-09 01:29:22] dunkel at calamus dot net In my problem case, the remote file does NOT exist. This is what I want to find out with fopen(). The according code looks like this: // don't check remote files with file_exists() !!! if ($lan == "cz") { $file = fopen("$url_docu", "rb"); if ($file) { echo "<blockquote>\n"; echo "<a href=\"$url_docu\" class=\"h4\">"; $this->echo_name($lan); echo " (HTML)</a>\n"; echo "</blockquote>\n"; fclose($file); } else [...] } In fact, $file is invalid here as it should. But in no case this function call of fopen() should give a warning about this, shouldn't it? In http://www.calamus.net/cz/modules/aln.php, you see how it works with existing remote files. In http://www.calamus.net/us/modules/aln.php, you can see how the result should be (refer to 'Manual' instead of the Czech 'Prirucka'). ------------------------------------------------------------------------ [2003-06-08 20:15:31] freddie at bingham dot net It very well does exist. Perhaps you just clicked on the url as presented on this page which adds a ', to the end. ------------------------------------------------------------------------ [2003-06-08 19:33:23] [EMAIL PROTECTED] Why shouldn't it give that error? The first url in your script does not exist. ------------------------------------------------------------------------ [2003-06-08 11:18:35] dunkel at calamus dot net For me, a similar problem exists in PHP 4.1.2 (on Apache): Take a look at http://www.calamus.net/cz/modules/wmf.php, please. In the paragraph "Příručka:" (Documentation:) I want to fopen() a page on a Czech server. As this page does not exist, a visible warning is been returned which should probably NOT occur here. Instead, I expect the function call to ONLY give back an invalid $fp. ------------------------------------------------------------------------ [2003-06-07 12:06:48] freddie at bingham dot net This is still happening in the 4.3.2 release This is the result of the above script: Warning: fopen(http://pub133.ezboard.com/bonesixthwarriors): failed to open stream: HTTP request failed! k› in test.php on line 3 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22937 -- Edit this bug report at http://bugs.php.net/?id=22937&edit=1