• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

[API RPC] 'Error 324 (net::ERR_EMPTY_RESPONSE)'

MariuszS

New Pleskian
Hi there.

I've got problem with subscription creation by API call.

I'm net getting response from curl when subscription is created.

With account creation (customer) I'm getting normal response.

Also when I'm trying to create subscription with domain which already exists in panel I'm getting normal response from API.

I will try to reproduce that:

1. making call to create subscription
2. getting empty response (subscription created in plesk panel)
3. trying call again subscritpion creation with the same parameters send previously
4 getting error from API about that domain already exists.

this is my code with deleted IP, and login details
class Plesk {

public function _makeRequest($params) {
$headers = array(
'HTTP_AUTH_LOGIN: xxxxxxxx',
'HTTP_AUTH_PASSWD: xxxxxxxxx',
'Content-Type: text/xml'
);

$xml = $this->_arrayToXml($params, new SimpleXMLElement('<packet version="1.6.3.0"></packet>'))
->asXML();

$ch = curl_init ();
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt ($ch, CURLOPT_URL, 'https://domain.com:8443/enterprise/control/agent.php');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_TIMEOUT, 480);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $xml);
//debug
curl_setopt($ch, CURLOPT_VERBOSE, true);


$result = curl_exec($ch);

if (curl_errno ($ch)) {
echo curl_errno ($ch) . ' - ' . curl_error ($ch);
}
curl_close($ch);
return $this->_parseResponse($result);
}

private function _arrayToXml(array $arr, SimpleXMLElement $xml) {
$numbers = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
foreach ($arr as $k => $v) {
if (is_array($v)) {
$this->_arrayToXml($v, $xml->addChild(str_replace($numbers, '', $k)));
} else {
$xml->addChild(str_replace($numbers, '', $k), $v);
}
}
return $xml;
}

private function _parseResponse($result) {
try {
$xml = simplexml_load_string($result, 'SimpleXMLElement', LIBXML_NOCDATA);
} catch (Exception $e) {
echo 'simpleXmlException: '.$e->getMessage();
}

return $xml;
}

public function toArray(SimpleXMLElement $xml) {
$array = (array)$xml;

foreach ( array_slice($array, 0) as $key => $value ) {
if ( $value instanceof SimpleXMLElement ) {
$array[$key] = empty($value) ? NULL : $this->toArray($value);
}
}
return $array;
}
}

$params = array(
'webspace' => array(
'add'=>array(
'gen_setup'=> array(
'name' => 'test.com',
'ip_address' => 'xxx.xxx.xxx.xxx',
'status' => '0',
),
)
),
);

$plesk= new Plesk;
$result=$plesk->_makeRequest($params);
var_dump($result);
 
Same problem

Did you ever get any help with this? I have exactly the same problem. Error 'Domain already exists' but the Customer and subscription are created correctly. I need to retrieve the ID and GUID after creation but it returns just the error string if you check the page source code.
The return page shows: Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. but the source does show the error if you echo it in your script by viewing page source.

Paul.
 
When the subscription is created, I noticed that the plesk creates a file in /usr/local/psa/var/httpd_restart

As apache is restarted, and the connection is lost.
 
Back
Top