fpassthru from remote URI

This is a discussion on fpassthru from remote URI within the PHP Language forums, part of the PHP Programming Forums category; Hi! I have a PHP page "transfer.php" and a MySQL db. The client should download binary files ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-21-2004
stefan.machwirth@debeka.de
 
Posts: n/a
Default fpassthru from remote URI

Hi!

I have a PHP page "transfer.php" and a MySQL db. The client should
download binary files by "http://.... /transfer.php?ID=xx", where the
ID is searched in the db and the real URI is read.

In the transfer.php the "Content-Encoding" and the
"Content-Disposition" header fields are set. Then I do a fpassthru() or
a readfile(), for example: readfile
("http://www.someserver.com/somefile.zip").

This works fine - theoretically... The problem is, that it takes a long
time befor the download dialog appears in the browser. I tried
readfile, I tried fpassthru, I tried "fopen ('http://...')" with an
"until feof"-loop. The script or the server first downloads the whole
file from the URL, and then passes the output buffer to the client :-(

Ah, I also tried ob_flush() and flush() ... no gain :-(

Is there a way to send the file data to the client while reading the
URL? I use PHP 4.3.7 and the CGI Gateway (Xitami in my test
environment).
Reply With Quote
  #2 (permalink)  
Old 09-21-2004
Daniel Tryba
 
Posts: n/a
Default Re: fpassthru from remote URI

stefan.machwirth@debeka.de wrote:
> Is there a way to send the file data to the client while reading the
> URL? I use PHP 4.3.7 and the CGI Gateway (Xitami in my test
> environment).


fopen/fsockopen should have worked. Code?

--

Daniel Tryba

Reply With Quote
  #3 (permalink)  
Old 09-22-2004
stefan.machwirth@debeka.de
 
Posts: n/a
Default Re: fpassthru from remote URI

Daniel Tryba wrote:

>>Is there a way to send the file data to the client while reading the
>>URL? I use PHP 4.3.7 and the CGI Gateway (Xitami in my test
>>environment).

>
>
> fopen/fsockopen should have worked. Code?


The problem is located. Not PHP buffers cause the delay, but Xitami. I
could simulate it with a "echo $somewhat; flush(); sleep (2);"-loop.
Buffering was disabled in php.ini. These delayed script also did not
transfer line by line to the browser with Xitami. But in my real
environment with Apache it worked.

I found some hints about the Xitami buffering in other newsgroups and
boards. Unfortunately it is not editable :-( Don't understand this
strategy. Xitami is very tiny and excellent for a small developing
environment. But if they don't improve it I would have found the first
limitation... :-/

Stefan
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:44 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0