Bug #15432 Updated: fopen does not work with password-protected URLs
| From: | mqm at magma dot ca | Date: | Thu, 07 Feb 2002 22:54:51 +0000 |
| Subject: | Bug #15432 Updated: fopen does not work with password-protected URLs | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-79601@lists.php.net to get a copy of this message | ||
ID: 15432
Updated by: mqm@magma.ca
Reported By: mqm@magma.ca
-Status: Feedback
+Status: Open
Bug Type: HTTP related
Operating System: Windows 2000
PHP Version: 4.1.0
New Comment:
curl (like wget) can fetch the page, so I don't think there are any
redirects.
This is what I get if I remove the @ before fopen:
<font color=ff0000><br>
<b>Warning</b>: fopen("http://...@192.168.3.1/Status.htm",
"r") - No
error in <b>C:\Xitami\webpages\test.php</b> on line <b>5</b><br>
</font>Can't fetch the page
(http://user:password@192.168.3.1/Status.htm), so I am giving up !!
Previous Comments:
------------------------------------------------------------------------
[2002-02-07 17:48:06] edink@php.net
I cannot reproduce this neither on Linux nor on Windows 2000. Does that
URL create any http redirects? Do you get any error messages if you
remove @ before fopen?
------------------------------------------------------------------------
[2002-02-07 16:14:58] mqm@magma.ca
Both curl and the web browser can fetch the document using the notation
below, no problem (so, the user/password is correct).
I was also able to fetch a password-protected page from dhs.org via
PHP, so I am not sure why it is failing for the Linksys web server.
Maybe if I could debug what is being sent/received over the wire.
------------------------------------------------------------------------
[2002-02-07 14:01:52] mqm@magma.ca
I am trying to fetch the web page from my Linksys ADSL router, which
is password-protected, but fopen does not seem to understand the URL
format where a user/password is provided (like with FTP). See below.
<?php
$linksys_info_url = "http://user:password@192.168.3.1/Status.htm";
$f_page = @fopen ($linksys_info_url, "r");
if ($f_page) {
$page_contents = fread ($f_page, 1024);
fclose ($f_page);
print ($page_contents);
} else {
echo "Can't fetch the page ($linksys_info_url), so I am giving up
!!";
}
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15432&edit=1