PHP 4.0 Bug #8552 Updated: fopen doesn't open URL
| From: | venaas@php.net | Date: | Fri, 05 Jan 2001 19:56:13 +0000 |
| Subject: | PHP 4.0 Bug #8552 Updated: fopen doesn't open URL | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-43080@lists.php.net to get a copy of this message | ||
ID: 8552
Updated by: venaas
Reported By: mike@newfangled.com
Old-Status: Open
Status: Closed
Bug Type: Filesystem function related
Assigned To:
Comments:
Turns out that the problem is redirects. fopen() doesn't follow
redirects any more. The semantics for fopen() and redirects is
being discussed.
Previous Comments:
---------------------------------------------------------------------------
[2001-01-04 11:56:31] mike@newfangled.com
Here's an example of something that works and doesn't work
==============================================
function GetWebPage( $url, $maxsize=1000000 )
{
// Open a connection to the site
$fp = fopen ($url, "r");
// Did we find it?
if (!$fp)
{
// Nope, return nothing
return "";
}
// Get the page
$webpage = fread($fp, $maxsize);
// Close the connection
fclose( $fp );
return $webpage;
}
// Doesn't work get error
print GetWebPage("http://ir.stockmaster.com/c/pbn/stocks.html");
// It Works
print GetWebPage("http://www.phpbuilder.com/columns/");
=========================================
// first GetWebPage fails
//
Warning: fopen("http://ir.stockmaster.com/c/pbn/stocks.html","r")
- No error in D:extranetWebTopsitet.php on line 25
---------------------------------------------------------------------------
[2001-01-04 11:35:14] mike@newfangled.com
$fp = fopen("http://ir.stockmaster.com/c/pbn/stocks.html","r");
Get "no such file".
Works perfect in php 3.0.16
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8552