<?php require 'soap_config.php'; $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri, 'trace' => 1, 'exceptions' => 1)); try { if ($session_id = $client->login($username, $password)) { echo 'Logged successfull. Session ID:' . $session_id . '<br />'; } //* Parameters $id = 1; //* Delete client $affected_rows = $client->client_delete($session_id, $id); echo "Number of records that have been deleted: " . $affected_rows . "<br>"; if ($client->logout($session_id)) { echo 'Logged out.<br />'; } } catch (SoapFault $e) { echo $client->__getLastResponse(); die('SOAP Error: ' . $e->getMessage()); }
public function Delete($operate_array, $create_array) { $soap_location = "http://" . $operate_array['ip'] . ":" . $operate_array['port'] . "/remote/index.php"; $soap_uri = "http://" . $operate_array['ip'] . ":" . $operate_array['port'] . "/remote/"; $username = $operate_array['adminname']; $password = $operate_array['adminpassword']; $client = new SoapClient(null, array('location' => $soap_location, 'uri' => $soap_uri)); if ($session_id = $client->login($username, $password)) { if ($clientid = $client->client_get_by_username($session_id, $create_array['clientlogin'])) { if ($client->client_delete($session_id, $clientid)) { return true; } else { throw new Exception("Unable to delete user with ID: " . $clientid); } } else { throw new Exception("Unable to find client ID by username: "******"Unable to login into ISPConfig 3 with username " . $username . " and password *********"); } }