<?php
/*
This is usefull when you are downloading big files, as it
will prevent time out of the script :
*/
$headers = array(
'HTTP_AUTH_LOGIN:USER',
'HTTP_AUTH_PASSWD:PW',
'Content-Type: text/xml'
);
$packet=<<<EOP
<packet version="1.6.3.0"><backup-manager><download-file><webspace-id>7</webspace-id><filename>resellers/c.peter/clients/chrillo/domains/drpeter.at/backup_drpeter.at_info_1204172251.xml</filename></download-file></backup-manager></packet>
EOP;
set_time_limit(0);
ini_set('display_errors',true);//Just in case we get some errors, let us know....
$ch = curl_init('https://HOST:' . 8443 . '/enterprise/control/agent.php');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $packet);
$response=curl_exec($ch);
$fp = fopen (dirname(__FILE__) . '/backup', 'w+');//This is the file where we save the information
fwrite($fp, $response);
fclose($fp);
$info =curl_getinfo($ch);
print_r($info);
print_r($response);
print_r($info);
curl_close($ch);
fclose($fp);
?>