• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Using the GetAccountByName method

E

eric4gh

Guest
Hi. I am building an API between WHMcs and Sitebuilder. I have automatic user/site creation working. Now I wish to delete a certain account. However, I am receiving this error when using the GetAccountByName method.

Listed below this error message is the code where I am using that method.:

Type: SoapFault
Message: Generic error. Internal Sitebuilder error. Base_SyntaxException: PHP Notice : Undefined property: stdClass::$username file: /usr/local/sitebuilder/include/SB/Actions/Admin/User/GetAccount.php line: 60 code: 8
Fault code: ERROR_GENERIC
Details: Internal Sitebuilder error. Base_SyntaxException: PHP Notice : Undefined property: stdClass::$username file: /usr/local/sitebuilder/include/SB/Actions/Admin/User/GetAccount.php line: 60 code: 8
File: /home/goodhost/public_html/billing3/includes/actionhooks.php
Line: 340
Code: 0

Code the generates this error:

$struct->username = $vars["username"]; // retrieves user name from WHMcs system

print $vars["username"];
print "<p>";
print_r($struct->username);

$accountService = $this->_getWebService('/AccountWebService.asmx?WSDL');

// first we must search to see if the username exists as a site in sitebuilder.

$result = $accountService->GetAccountByName($struct->username);

// then if there is a match, delete that site

$result2 = $accountService->DeleteAccount(new SoapVar($result, SOAP_ENC_OBJECT));

~~~

I have also tried using the method by supplying a variable and the hardcoded string "sitetest1" for example, and the same error message above is generated.

I have also passed in an account object

$struct->username = $vars["username"];

$result = $accountService->GetAccountByName(new SoapVar($struct, SOAP_ENC_OBJECT));

but the same error is generated.

Can anyone tell me how I should be using the GetAccountByName API method to process correctly?

Thank you.
 
Back
Top