// Include class curl/curl
$curl = new \Curl\Curl();
// If you also connect via the HTTPS protocol and you get errors,
// you should first try to activate the following options. Just remove the two
// Slashes at the beginning of each line.
// $curl->setOpt(CURLOPT_RETURNTRANSFER, TRUE); // (optional)
// $curl->setOpt(CURLOPT_SSL_VERIFYPEER, FALSE); // (optional)
// Store client key in variable
$client = "JDJ5JDEwJDJpeTN4bzFKWFNldmhBbXJVRWFLWU9oNXJZUzU1MU4zZlZJWGYuaXpXWmVFWVFGaG5zSHFD";
// Store secret key in variable
$secret = "JDJ5JDEwJFNLUGE4VnFCMmdyeHlnOGNSVzJmUS5kdy9FZVowR0pkMXFIZ1ZkbXhhOHNLUDN0akF1YmlL";
// First we create an array with the ids of the virtual server to which the new one
// webuser should get access. These Ids you can, for example, from the
// Get the serverlist in the TSI
$vServers = array("1", "7");
// Here we assign the selected virtual servers the respective instance to which they belong
// and form an array again by mapping the id of the instance to the virtual servers.
// You can also get this Id from the instance overview of the dashboard. It would be here too
// possible to declare multiple instances with multiple vServers
$instance = array("12" => $vServers);
// Now we form a final array by specifying the data of the new webuser
// and assign the previously declared instance as "fixed_virtual_servers".
"fixed_virtual_servers" => $instance
// Send request with action parameter "userAdd"
'data' => $new_user /*Here we pass the data of the new webuser*/
// Here we check whether the connection could be successfully made using CURL and
// if not, we issue the error with echo
echo "cURL Error: " . $curl->error_message;
// If the connection was successful with cURL, we check if the interface is the
// request accepted. To do this, we convert the answer string into a json_decode
// array around and check if the field "valid" is true, if there is not an error, the
// we average echo and the field "error".
$response = json_decode($curl->response, true);
// If successful, the id of the new webuser is displayed here as the return value
// If the authentication fails, the error message is displayed here
echo "API Error: " . $response["error"];
As in Example 2, I hope that the source code understands how it works. If there are any questions left, just leave a comment.