Adding a user with the FileCOPA Command Server
You can use the FileCOPA Command Server to add new users. This is a brief example of how to add 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.="<password>NewUser1Password</password>\n"; $adduser_xml.="<rootdir><![CDATA[c:\\incoming\\newuser1]]></rootdir>\n"; $adduser_xml.="<createrootdir>1</createrootdir>\n"; // 0 or 1 default = 0 $adduser_xml.="<disabled>0</disabled>\n"; // 0 or 1 default = 0 $adduser_xml.="<allowpasswordchange>1</allowpasswordchange>\n"; // 0 or 1 default = 0 $adduser_xml.="<idletimeout>1</idletimeout>\n"; // default = 3 $adduser_xml.="<comments><![CDATA[Comments about user]]></comments>\n"; // 0 or 1 default = 0 $adduser_xml.="<expire>1</expire>\n"; // 0 or 1 default = 0 $adduser_xml.="<expiredelete>1</expiredelete>\n"; // 0 or 1 default = 0 $adduser_xml.="<expireondate>1</expireondate>\n"; // 0 or 1 default = 0 $adduser_xml.="<expiredays>5</expiredays>\n"; // only used if expireondate=0, default=1 $adduser_xml.="<expiredate>2013-06-01</expiredate>\n"; // only used if expireondate=1, yyyy-mm-dd $adduser_xml.="<sshpublickey>ssh-rsa AAAAB3NzaC1yc2E</sshpublickey>\n"; $adduser_xml.="</user>\n"; $username="commanduser"; $password="commandpassword"; $c=curl_init(); curl_setopt($c,CURLOPT_URL, "http://192.168.10.5/adduser"); 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); ?>