Secure FTP Server/SFTP Server

18 Route 6A, Sandwich, MA 02563 USA

70 Bridle Close, Paignton, Devon, TQ4 7ST UK

Deleting a user with the FileCOPA Command Server

You can use the FileCOPA Command Server to delete users. This is a brief example of how to delete a user using PHP connecting to the FileCOPA command Server.

<?php
        $adduser_xml ="<?xml version='1.0' encoding='utf-8'?>\n";
        $adduser_xml.="<user>\n";
        $adduser_xml.="<username>NewUser1</username>\n";
        $adduser_xml.="</user>\n";

        $username="commanduser";
        $password="commandpassword";

        $c=curl_init();
        curl_setopt($c,CURLOPT_URL, "http://192.168.10.5/deleteuser");
        curl_setopt($c,CURLOPT_PORT,7498);
        curl_setopt($c,CURLOPT_USERPWD,$username.":".$password);
        curl_setopt($c,CURLOPT_POSTFIELDS,$adduser_xml);
        curl_setopt($c,CURLOPT_HTTPHEADER,array("Connection: Close"));

        $result=curl_exec($c);

        if(curl_errno($c)) print("<p>Error - " . curl_errno($c) . " - " . curl_error($c) . "</p>\n");
        else {
                $resultcode=curl_getinfo($c,CURLINFO_HTTP_CODE);

                print("<p>Result Code: " . $resultcode . "</p>\n");
        }
        curl_close($c);
?>