Description
This API allows you to change the password of an existing FTP account within Webuzo.
Parameters
Sample Code
curl --insecure -d "fuser=FTP_USERNAME" -d "changepass=1" -d 'newpass=FTP_PASSWORD' -d 'conf=CONFIRM_PASSWORD' -u "USERNAME:PASSWORD" -X POST "https://51.79.235.189:2003/index.php?api=json&act=editftp"<?php
$user = 'your_user';
$pass = 'your_password';
$ip = 'your_ip';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$ip.':2003/index.php?api=json&act=editftp';
$post = array('changepass' => '1', 'fuser' => 'new_dns.189.compilor.com', 'newpass' => 'FTP_PASSWORD', 'conf' => 'CONFIRM_PASSWORD');
// 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. In this case its PHP JSON
$res = json_decode($resp, true);
// Done ?
if(!empty($res['done'])){
print_r($res['done']);
// Error
}else{
print_r($res['error']);
}Output
Array ( [msg] => The FTP user password has been changed successfully.)