Dear Plesk-lovers,
Since last week I'm running in trouble with the Plesk RPC api. At the moment I'm in the progress of developing a custom made PHP-script to handle orders at my website, when a customers buys webhosting at the shop the script automatically creates the user account, creates the domain, add aliasses and all other stuff.
My script was working till last week and since then I've trouble with just 1 part of the script the creation of the domain itself. Creating of the user is working as expected.
The thing is it is a really strange issue as the domain itself is created on plesk but the output that I expect is not returned by plesk. Let me explain this a bit with some php snippets:
This is the code that is giving errors:
The first line createXML_DomainAdd creates a valid XML package to send to plesk, something like this:
After the packet creation the packet is send to plesk with the SendCommand function:
And after that the output returned from plesk is analysed in ParseCurl function:
When I'm trying to load this in Firefox the following is taking place:
- The xml packet is created
- XML packet is send to Plesk
- Plesk created the domain and domain is working fine
- I retreive an "Connection has been re-initialized" window in Firefox and the script stops here
- NO return output is retreived from plesk
when I do the same in Internet Explorer, i didn't receive the connection has been re-initialized screen but the pages loads, a white screen comes up and the page loads again.
After some troubelshooting I've found that Plesk is not returning any value in the parseCurl function, the status code that I retreive from $info['http_code'] is 0.
I can't get what's going wrong but I'm pretty sure that there is something wrong at plesk side now (as it was working till last week).
I installed latest updates today and also rebooted the server, but no luck..
Since last week I'm running in trouble with the Plesk RPC api. At the moment I'm in the progress of developing a custom made PHP-script to handle orders at my website, when a customers buys webhosting at the shop the script automatically creates the user account, creates the domain, add aliasses and all other stuff.
My script was working till last week and since then I've trouble with just 1 part of the script the creation of the domain itself. Creating of the user is working as expected.
The thing is it is a really strange issue as the domain itself is created on plesk but the output that I expect is not returned by plesk. Let me explain this a bit with some php snippets:
This is the code that is giving errors:
Code:
$xmlPacket2=createXML_DomainADD($domeinen[0],$kl_guid,strtolower($ftp_username),$ftp_password,$pakket);
$curl2 = sendCommand($xmlPacket2,$HOST,$PATH,$LOGIN,$PASSWD);
$response = parseCurl($curl2);
The first line createXML_DomainAdd creates a valid XML package to send to plesk, something like this:
Code:
<packet version="1.6.3.1">
<webspace>
<add>
<gen_setup>
<name>test.com</name>
<owner-guid>ab70944d-b591-4063-8131-768d00b15a3a</owner-guid>
<htype>vrt_hst</htype>
<ip_address>A.B.C.D</ip_address>
<status>0</status>
</gen_setup>
<hosting>
<vrt_hst>
<property>
<name>ftp_login</name>
<value>ftp_login</value>
</property>
<property>
<name>ftp_password</name>
<value>cuji83cx</value>
</property>
<ip_address>A.B.C.D</ip_address>
</vrt_hst>
</hosting>
<plan-name>X1</plan-name>
</add>
</webspace>
</packet>
After the packet creation the packet is send to plesk with the SendCommand function:
Code:
function sendCommand($xmlPacket,$host,$path,$login,$passwd)
{
$url = "https://" . $host . ":8443". "/" . $path;
$headers = array(
"HTTP_AUTH_LOGIN: " . $login,
"HTTP_AUTH_PASSWD: " . $passwd,
"HTTP_PRETTY_PRINT: TRUE",
"Content-Type: text/xml",
);
// Initalize the curl engine
$ch = curl_init();
// Set the curl options
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch,CURLOPT_POSTFIELDS,$xmlPacket);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,60);
curl_setopt($ch,CURLOPT_STDERR,'logs.log');
curl_setopt($ch,CURLOPT_VERBOSE,1);
return $ch;
}
And after that the output returned from plesk is analysed in ParseCurl function:
Code:
function parseCurl($ch){
$result = curl_exec($ch);
$info=curl_getinfo($ch);
if($info['http_code']!=200){
return false;
}else{
$xml = new SimpleXMLElement($result);
if(!is_a($xml,'SimpleXMLElement')){
return false;
}else{
return $xml;
}
}
curl_close($ch);
}
When I'm trying to load this in Firefox the following is taking place:
- The xml packet is created
- XML packet is send to Plesk
- Plesk created the domain and domain is working fine
- I retreive an "Connection has been re-initialized" window in Firefox and the script stops here
- NO return output is retreived from plesk
when I do the same in Internet Explorer, i didn't receive the connection has been re-initialized screen but the pages loads, a white screen comes up and the page loads again.
After some troubelshooting I've found that Plesk is not returning any value in the parseCurl function, the status code that I retreive from $info['http_code'] is 0.
I can't get what's going wrong but I'm pretty sure that there is something wrong at plesk side now (as it was working till last week).
I installed latest updates today and also rebooted the server, but no luck..
Last edited: