kinlane
4/15/2012 - 8:02 PM

IDrive - EVS - REST API - downloadFile

IDrive - EVS - REST API - downloadFile

<?php
$webApiServer = "[path to server from previous getServerAddress]";

$uid = "[your IDrive user]";
$pwd = "[your IDrive password]";

$crtpath = '[path to your local cert for curl calls]';
$localfilepath = '[Your download file path]';
$pvtkey = '[your private key]';

// file
$PostFields = array(
  'uid' => $uid,
  'pwd' => $pwd,
  'p' => $localfilepath,
  'pvtkey' => $pvtkey,
  'version' => '1',
  'thumbnail_type' => 'S',
  'trash' => 'no'
);

$ch = curl_init();
$url = "https://" . $webApiServer. "/evs/downloadFile ";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// POST
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $PostFields);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));

// SSL
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); 
curl_setopt($ch,CURLOPT_CAINFO,$crtpath);

// Output
$output = curl_exec($ch);

curl_close($ch);
?>