php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #14976 gzopen URLs like fopen() does
Submitted: 2002-01-10 15:06 UTC Modified: 2002-11-28 06:31 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: epicanis+php at dogphilosophy dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.1.1 OS: ANY (Linux)
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: epicanis+php at dogphilosophy dot net
New email:
PHP Version: OS:

 

 [2002-01-10 15:06 UTC] epicanis+php at dogphilosophy dot net
One feature of PHP that I find REALLY handy is the 
transparent handling of 'remote' files (i.e. http:// and 
ftp:// URL's).  

Currently gzopen "doesn't quite" handle anything but local 
files.  Attempting to gzopen, for example, an 
"ftp://some.host.net/pub/somefile.gz" URL currently 
returns a strange error (the error itself reported as 
Bug#14814).

I traced a gzopen("ftp://some.host.net/pub/somefile.gz") 
sort of connection with ethereal, and noticed that 
connection to the ftp server IS made, login is performed, 
passive mode switched to, and the file is STARTED 
downloading (about 3 1k packets came across) but the 
script dies with a "Warning: Success in ...." error 
message.

As I'm running the script from the command line as a 
standalone utility, I can instead do something like :
wget -q ftp://some.host.net/pub/somefile.gz | php 
gzfilething.php > gzoutput.txt

and gzopen("php://stdin") to process the text, and it does 
work fine, but it's a bit awkward to use and is 
inconsistent with fopen()'s behavior.

Note that the fopen with "zlib:" URL's doesn't work for 
remote files, either (how would you write such a thing?  
fopen("zlib:ftp://some.host.net/pub/somefile.gz","r")?  I
tried several variations and confirmed that zlib: 
automatically assumes a local filehandle.

Thanks!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-28 06:31 UTC] wez@php.net
You can do this in 4.3:

fopen("compress.zlib://http://foobar.com");

It would be great if you could test RC2 and verify that
this works.
RC2 available from http://qa.php.net
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 01:01:27 2024 UTC