HTTP_Download::HTTP_Download

HTTP_Download::HTTP_Download() – Constructor

Synopsis

require_once 'HTTP/Download.php';

object new HTTP_Download ( array $params = array() )

Description

Creates an instance of an HTTP_Download object and sets supplied parameters.

Parameter

  • array $params - An associative array of parameters:

    • one of:

      • $params['file'] - filepath

      • $params['data'] - raw data

      • $params['resource'] - resource handle

    • and any of:

      • $params['gzip'] - whether to gzip the download

      • $params['cache'] - whether to allow client side caching of the download

      • $params['lastmodified'] - unix timestamp of last modification

      • $params['contenttype'] - content type

      • $params['contentdisposition'] - content disposition

      • $params['buffersize'] - amount of bytes read at once from files or resources

      • $params['throttledelay'] - amount of seconds to sleep after each chunk that has been sent

      • $params['cachecontrol'] - cache privacy and validity

Introduction in usage of HTTP_Download (Previous) Set various parameters (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

Note by: redbeard
To make things work properly under PHP5 I believe each parameter has to have the same capitalization as the set*() commands, e.g. 'CacheControl' and 'Gzip' instead of 'cachecontrol' and 'gzip'. The reason for this is that setParams() uses 'set' . $param to build a method call. This works fine in PHP4 but (IIRC) breaks in PHP5.

Also, if a method takes more than one parameter it can be set with each parameter as an element of an array. For instance, you can set the cache control with 'CacheControl' => array('public', 2592000).