Description
Use the List FTP Accounts API to list FTP users in Webuzo account.
Parameters
Sample Code
curl --insecure -u "USERNAME:PASSWORD" -X POST "https://hostip:2003/index.php?api=json&act=ftp"
<?php
$user = 'your_user';
$pass = 'your_password';
$ip = 'your_ip';
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$ip.':2003/index.php?api=json&act=ftp';
// 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['ftp_list'])){
print_r($res['ftp_list']);
}
<?php
include_once('/usr/local/webuzo/sdk/webuzo_sdk_v2.php');
$user = 'your_user';
$pass = 'your_password';
$host = 'your_ip';
$webuzo = new Webuzo_SDK($user, $pass, $host);
$res = $webuzo->list_ftpuser();
// Done/Error
if(!empty($res['ftp_list'])){
print_r($res['ftp_list']);
}
?>
Output
Array ( [user1] => Array ( [path] => /home/user1/ [quota] => 0 Mb (unlimited) [usage] => 385.79 ) [ftp1_user1domain.com] => Array ( [path] => /home/user1/ftp1/ [quota] => 0 Mb (unlimited) ) [ftp2_test201.compilor.com] => Array ( [path] => /home/user1/ftp2/ [quota] => 0 Mb (unlimited) [usage] => 222.71 ) )