Exemplo n.º 1
0
<?php

require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'Bootstrap.php';
use Zend\Service\LiveDocx\Helper;
use Zend\Service\LiveDocx\MailMerge;
Helper::printLine(PHP_EOL . 'Downloading Remotely Stored Images' . PHP_EOL . PHP_EOL);
$mailMerge = new MailMerge();
$mailMerge->setUsername(DEMOS_ZEND_SERVICE_LIVEDOCX_USERNAME)->setPassword(DEMOS_ZEND_SERVICE_LIVEDOCX_PASSWORD);
$counter = 1;
foreach ($mailMerge->listImages() as $result) {
    printf('%d) %s', $counter, $result['filename']);
    $image = $mailMerge->downloadImage($result['filename']);
    file_put_contents('downloaded-' . $result['filename'], $image);
    print ' - DOWNLOADED.' . PHP_EOL;
    $counter++;
}
print PHP_EOL;
unset($mailMerge);