PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work
| From: | hholzgra@php.net | Date: | Mon, 20 Nov 2000 15:22:12 +0000 |
| Subject: | PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38618@lists.php.net to get a copy of this message | ||
ID: 7880
Updated by: hholzgra
Reported By: Alan@Halachmi.net
Status: Assigned
Bug Type: *URL Functions
Assigned To: jason@php.net
Comments:
ooops, looks like this was to early in the morning :(
but it might still be of interest what the output and
error messages look like if you take your code snippet
and just replace the '$fp=file($url)' line with '$fp=fopen($url,"r")'
it seems like file() fails to open the URL but still tries
to read from the file handle that is not valid in this case,
so that 'bad file number' is reported instead of the real cause
if failure ...
PS: i don't think this is realy related to it, but www.php.net/index.html
does not exist. trying to GET it will result in a 404 status and an
error page showing some search results, you should try
www.php.net/index.php instead, just to be sure ...
Previous Comments:
---------------------------------------------------------------------------
[2000-11-20 09:54:13] jason@php.net
Actually he is using the correct usage. File takes a string calls fopen-wrappers to open a fp, and
then returns an array
Alan, I will see If I can reproduce your findings
-Jason
---------------------------------------------------------------------------
[2000-11-20 07:01:04] hholzgra@php.net
$url = "http://www.php.net/index.html";
$fp = file($url);
is simply wrong usage, try
$url = "http://www.php.net/index.html";
$fp = fopen($url,"r");
$file_contents = file($fp);
instead
---------------------------------------------------------------------------
[2000-11-20 04:40:48] Alan@Halachmi.net
More interesting information... It appears that the outbound connection is never actually made...
This is from a truss of an fopen on www.php.net:
14354/1: resolvepath("/home/pkw/devilnet/v1.0/dev/htdocs/filetest.php",
"/home/pkw/devilnet/v1.0/dev/htdocs/filetest.php", 1024) = 47
14354/1: ioctl(6, TCGETA, 0xFFBEE33C) Err#25 ENOTTY
14354/1: fstat64(6, 0xFFBECBD0) = 0
14354/1: d=0x02200007 i=275213 m=0100644 l=1 u=1001 g=4 sz=283
14354/1: at = Nov 20 04:21:57 EST 2000 [ 974712117 ]
14354/1: mt = Nov 20 03:55:45 EST 2000 [ 974710545 ]
14354/1: ct = Nov 20 03:55:45 EST 2000 [ 974710545 ]
14354/1: bsz=8192 blks=2 fs=ufs
14354/1: ioctl(6, TCGETA, 0xFFBECB5C) Err#25 ENOTTY
14354/1: read(6, " < ?nt $ u r l = "".., 8192) = 283
14354/1: read(6, 0x00303264, 8192) = 0
14354/1: ioctl(6, TCGETA, 0xFFBECC34) Err#25 ENOTTY
14354/1: llseek(6, 0, SEEK_CUR) = 283
14354/1: close(6) = 0
14354/1: so_socket(2, 1, 0, "", 1) = 6
14354/1: connect(6, 0x001378B8, 16, 1) = 0
14354/1: AF_INET name = 127.0.0.1 port = 53
14354/1: send(6, "96 g01