php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12965 fopen() don't open URL files
Submitted: 2001-08-26 10:45 UTC Modified: 2001-08-28 14:24 UTC
From: ronaldo at inbox dot lv Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0.6 OS: Windows2000
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: ronaldo at inbox dot lv
New email:
PHP Version: OS:

 

 [2001-08-26 10:45 UTC] ronaldo at inbox dot lv
I'm using PhP 4.0.6 with Apache 1.3 and the
problem is opening remote files with fopen("http://...");

The following code:

>$fp = fopen("http://www.php.net", "r") or die("OPEN");
>while (! feof($fp))
>{
>    fread($fp, 1024) or die("READ");
>}
>fclose($fp) or die("CLOSE");

Produced the following output:

>Warning: php_hostconnect: connect failed in filename.php..
>
>Warning: fopen("http://www.php.net","r") - Bad file
>descriptor in filename.php..


I tried to use fsockopen() with my IE proxy and port settings - it was successful. Maybe the problem is in Apache configuration, but I just can't figure that out!

If you can help, please, send to my email: ronaldo@inbox.lv

Kind regards

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-28 14:24 UTC] sander@php.net
I got a slightly different error:

Warning:  fopen("http://www.php.net","r") - No error in e:\sander\webserver\http\test\test1.php on line 10

If you append a / to the url, it works:
fopen("http://www.php.net/", "r")

The errors are a bit weird though...

Let's make it a bogus.
 [2004-01-05 04:29 UTC] filipoiu_victor at yahoo dot com
try this:
$my_file = file ("http://www.google.com/search?q=%22invented%20the%20car%22&btnG=Google+Search");

it will result:
No error in my_script.php on line xxx

I have Win98SE
PHP 4.3.4
OmniHTTPD 2.10
IE 5.5

The same thing works under PHP 4.3.4, Win2000 with IIS and IE6
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 17:01:33 2025 UTC