• 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!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    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. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

Add client issue with API (Using PHP)

D

Dr_Zaius

Guest
Hi all, I have a reseller account for Plesk Panel and I am trying to automate client creation, on submitting the XML I get the error code "1014" with the error message "Error while scaning: Can not navigate to the specified node/offset", the code does not return an error (or work obviosuly) if I comment out the line "$client->appendChild($add);".

The code is as follows:
$xmldoc = new DomDocument('1.0', 'UTF-8');

$xmldoc->formatOutput = true;



// <packet>

$packet = $xmldoc->createElement('packet');

$packet->setAttribute('version', '1.4.1.2');

$xmldoc->appendChild($packet);



// <packet/client>

$client = $xmldoc->createElement('client');

$packet->appendChild($client);



// <packet/client/add>

$add = $xmldoc->createElement('add');

$client->appendChild($add);



// <packet/client/add/geninfo>

$geninfo = $xmldoc->createElement('geninfo');

$add->appendChild($geninfo);



// create child element

$cname = $xmldoc->createElement("cname");

$geninfo->appendChild($cname);



// create text node

$text = $xmldoc->createTextNode("test company");

$cname->appendChild($text);



// create child element

$pname = $xmldoc->createElement("pname");

$geninfo->appendChild($pname);



// create text node

$text = $xmldoc->createTextNode("test name");

$pname->appendChild($text);



// create child element

$login = $xmldoc->createElement("login");

$geninfo->appendChild($login);



// create text node

$text = $xmldoc->createTextNode("testlogin");

$login->appendChild($text);



// create child element

$passwd = $xmldoc->createElement("passwd");

$geninfo->appendChild($passwd);



// create text node

$text = $xmldoc->createTextNode("testpass");

$login->appendChild($text);



// create child element

$status = $xmldoc->createElement("status");

$geninfo->appendChild($status);



// create text node

$text = $xmldoc->createTextNode("0");

$login->appendChild($text);



// create child element

$phone = $xmldoc->createElement("phone");

$geninfo->appendChild($phone);



// create text node

$text = $xmldoc->createTextNode("0123456789");

$phone->appendChild($text);




// <packet/client/add/template-name>

$templatename = $xmldoc->createElement('template-name');

$add->appendChild($templatename);



// create text node

$text = $xmldoc->createTextNode("Unlimited Plan");

$templatename->appendChild($text);

Can anyone advise where I am going wrong here?
 
Back
Top