I am using the following code to create a downloader. It works, except
that IE will just dump the contents to it's browser and Netscape 4
asks if I want to save it in a file called "blah.php".


     // File: blah.php

     if ( ! $fp = fsockopen ("www.steptwo.com.au", 80, $errno, $errstr, 30) )
     {
         echo "$errstr ($errno)<br>\n";
     }
     else
     {
         $userpass = "user:password";
         fputs ($fp, "GET /files/file.zip HTTP/1.0\r\n" .
                     "Host: www.steptwo.com.au\r\n" .
                     "Authorization: Basic " . base64_encode( $userpass ) . 
"\r\n" .
                     "\r\n");

         while ( $headerStr = trim( fgets( $fp , 3072 ) ) )
         {
             if ( strpos( $headerStr, ":" ) )
                 header( $headerStr );
         }


         fpassthru( $fp );
     }

Is there any way to get it to save as a file called "file.zip"?
Is there any header I can set? The headers it currently returns
are:

    Date: Tue, 23 Apr 2002 06:02:36 GMT
    Server: Apache/1.3.12 (Unix) ApacheJServ/1.1.2 PHP/4.0.1pl2 
FrontPage/4.0.4.3 mod_ssl/2.6.6 OpenSSL/0.9.5a
    Last-Modified: Tue, 23 Apr 2002 05:13:07 GMT
    ETag: "61b3e-ba-3cc4ed63"
    Accept-Ranges: bytes
    Content-Length: 186
    Connection: close
    Content-Type: application/zip

regs

Brian White
-------------------------
Brian White
Step Two Designs Pty Ltd
Knowledge Management Consultancy, SGML & XML
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to