• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

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