string PEAR_Common::downloadHttp (
, object &$ui
, string $save_dir = '.'
, mixed $callback
Download a file through HTTP. Considers suggested file name in Content-disposition: header and can run a callback function for different events. The callback will be called with two parameters: the callback type, and parameters. The implemented callback types are:
called at the very beginning, parameter is a
UI object that should be used for all output
the parameter is a string with an informational message
may be used to save with a different file name, the
parameter is the filename that is about to be used.
returns a non-empty string, that file name will be
used as the filename instead.
$save_dir will not
be affected by this, only the basename of the file.
download is starting, parameter is number of bytes
that are expected, or -1 if unknown
parameter is the number of bytes read so far
'done' - download is
complete, parameter is the total number
of bytes read
if the TCP connection fails, this callback is called
if writing to disk fails, this callback is called
If an HTTP proxy has been configured
http_proxy PEAR_Config setting),
the proxy will be used.
the URL to download
directory to save file in
function/method to call for status updates
Returns the full path of the downloaded file or a
PEAR error on failure. If the error is caused by
socket-related errors, the error object will
have the fsockopen error code available through
|Error code||Error value||Meaning||Solution|
This function can not be called statically.