php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8552 fopen doesn't open URL
Submitted: 2001-01-04 11:35 UTC Modified: 2001-01-05 14:56 UTC
From: mike at newfangled dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.4 OS: Windows 2000 Server SP1
Private report: No CVE-ID: None
 [2001-01-04 11:35 UTC] mike at newfangled dot com
$fp = fopen("http://ir.stockmaster.com/c/pbn/stocks.html","r");

Get "no such file".

Works perfect in php 3.0.16

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-04 11:56 UTC] mike at newfangled dot 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:\extranet\WebTop\site\t.php on line 25



 [2001-01-05 14:56 UTC] venaas@php.net
Turns out that the problem is redirects. fopen() doesn't follow
redirects any more. The semantics for fopen() and redirects is
being discussed.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 11 21:01:28 2024 UTC