buy
FTP Connections

Description

Use the FTP Connections API to list the current active FTP connections.

Parameters

Sample Code

curl -ku "username:password" "https://hostip:2003/index.php?api=json&act=ftp_connections"
<?php
$user = 'your_user';
$pass = 'your_password';
$ip = 'your_ip';
 
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$ip.':2003/index.php?api=json&act=ftp_connections'; 

// 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_ftp_connections();

// Done/Error
if(!empty($res['ftp_list'])){
	print_r($res['ftp_list']);
}

?>

Output

Array ( [25648] => Array ( [pid] => 25648 [ftp_user] => user1 [ftp_timestamp] => 1667829235 [status] => IDLE [log_from] => 100.216.129.166 ) )

Delete FTP Connections

Use the Delete FTP Connections API to deletethe current active FTP connections.

FTP Connections list is required to get the exact process id (pid) to delete a specific FTP connections.

Please refer this following Output of FTP Connections API list to know the ftp_connection_pid value.

image

Sample Code

curl -ku "username:password" "https://hostip:2003/index.php?api=json&act=ftp_connections&ftp_connection_pid=27628"
<?php
$user = 'your_user';
$pass = 'your_password';
$ip = 'your_ip';
 
$url = 'https://'.rawurlencode($user).':'.rawurlencode($pass).'@'.$ip.':2003/index.php?api=json&act=ftp_connections'; 

$post = array('ftp_connection_pid' => '27628');

// 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']);
}
<?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);
$pid = '27628';

$res = $webuzo->delete_ftp_connection($pid);

// Done/Error
if(!empty($res['error'])){
	print_r($res['error']);
}else{
	print_r($res['done']);
}

?>

Output

Array ( [msg] => FTP connection disconnected successfully. )
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list