According to the documentation I have to use the following code:
<packet>
<backup-manager>
<download-file>
<server></server>
<filename>backup_info_1903291320.xml</filename>
</download-file>
</backup-manager>
</packet>
However, when I execute the script I get the following error
Allowed memory size of 134217728 bytes exhausted (tried to allocate 65019904 bytes)
Ive tried to set the memory limit in PHP.
ini_set('memory_limit', '-1');
But that doens't work either, it runs out of memory.
Out of memory (allocated 524288000) (tried to allocate 520097792 bytes)
Did I execute the request correctly? Other requests work fine, like requesting a list of backups. Only trying to download it breaks my code. I hope a Plesk expert can help me out here.
This is the code I wrote:
class Plesk_Synch
{
private $node1;
private $node2;
public function __construct()
{
$this->node1 = new \PleskX\Api\Client( 'IP_OF_THE_SERVER' );
$this->node1->setCredentials( 'username', 'pass' );
$this->node2 = new \PleskX\Api\Client( 'IP_OF_THE_SERVER' );
$this->node2->setCredentials( 'username', 'pass' );
}
public function init()
{
}
public function download_backup()
{
$request = <<<EOF
<packet>
<backup-manager>
<download-file>
<server></server>
<filename>backup_info_1903291320.xml</filename>
</download-file>
</backup-manager>
</packet>
EOF;
return $this->node1->request($request);
}
}
$plesk_synch = new Plesk_Synch();
// Download backup
$plesk_synch->download_backup();