Description
Use the Update Settings API to update your server's Update configuration settings.
Parameters
Sample Code
curl --insecure -d "editsettings=1" -d "update=1" -d "email_update_apps=1" -d "no_auto_update_system=1" -d "email_update=0" -d "cron_time=17 17 * * *" -d "php_bin=/usr/local/emps/bin/php" -u "username:password" -X POST "https://hostname:2005/index.php?api=json&act=update_settings"
<?php
$user = 'user_name';
$pass = 'password';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@domain.com:2005/index.php?api=json&act=update_settings';
$post = array('editsettings' => 1,
'update' => '2',
'email_update_apps' => '1',
'no_auto_update_system' => '1',
'email_update' => '0',
'cron_time' => '40 17 * * *',
'php_bin' => '/usr/local/emps/bin/php'
);
// Set the curl parameters
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if(!empty($post)){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
}
// Get response from the server.
$resp = curl_exec($ch);
// The response will hold a string as per the API response method.
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
echo "<pre>";
print_r($res['done']);
echo "</pre>";
}else{
print_r($res['error']);
}
Output
The settings were saved successfully