PHP Download

This is a basic PHP example showing how to access files available for download from the system, using the Download Endpoint.

As downloads are related to the Customer Space, and for security, it is necessary to provide login details to be able to access the files. This is done using HTTP Basic Authentication.

The example simply shows how to retrieve the contents of the file and does not go into the process of saving or extracting a ZIP file contents. The exact URL required for a particular file type is detailed in the Return Value of the various methods that generate files.


$username    = '';
$password    = 'pass';
$downloadKey = 'abc123';
$url         = '' . $downloadKey;

$opts = array(
    'http' => array(
        'header' => sprintf("Authorization: Basic %s\r\n", base64_encode($username . ':' . $password))

$context = stream_context_create($opts);

$local  = fopen('', 'w');
$remote = fopen($url, 'r', false, $context);

while ($data = fread($remote)) {
    fwrite($local, $data);