D
D
Dmitry2015-10-01 21:47:42
PHP
Dmitry, 2015-10-01 21:47:42

How to get a file from the Zamzar service?

Hello!
If anyone has come across using api zamzar - www.zamzar.com , so I do everything, I upload the file, everything is in order, but for some reason I can’t download it, according to the official dock:

<?php
$fileID = 3;
$localFilename = '/tmp/portrait.png';
$endpoint = "https://sandbox.zamzar.com/v1/files/$fileID/content";
$apiKey = "f9bddee74";

$ch = curl_init(); // Init curl
curl_setopt($ch, CURLOPT_URL, $endpoint); // API endpoint
curl_setopt($ch, CURLOPT_USERPWD, $apiKey . ":"); // Set the API key as the basic auth username
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);

$fh = fopen($localFilename, "wb");
curl_setopt($ch, CURLOPT_FILE, $fh);

$body = curl_exec($ch);
curl_close($ch);

echo "File downloaded\n";

But for some reason the file is empty. Help what you can)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question