• 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 using ASP 3.0

L

LeandroC

Guest
I need an example of Plesk 8.6 API using ASP 3.0. This example is in PHP as it does in ASP.

<?php
define("HOST", "200.xxx.xxx.xx");
define("PORT", 8443);
define("PATH", "enterprise/control/agent.php");
define("LOGIN", "");
define("PASSWD", "");
define("PROTO_VER", "1.3.1.0");
$proto = PROTO_VER;
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="1.4.2.0">
<domain>
<add>
<gen_setup>
<name>newdomain.com</name>
<htype>vrt_hst</htype>
<ip_address>200.xxx.xxx.xxx</ip_address>
<status>0</status>
</gen_setup>
<hosting>
<vrt_hst>
<ftp_login>c4u7dwbc2y8</ftp_login>
<ftp_password>qweqwe</ftp_password>
<ip_address>200.xxx.xxx.xx</ip_address>
</vrt_hst>
</hosting>
</add>
</domain>
</packet>
EOF;
function write_callback($ch, $data)
{
echo $data;
return strlen($data);
}
function sendCommand()
{
$url = "https://" . HOST . ":" . PORT . "/" . 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_SSL_VERIFYHOST, 0);
// this line makes it work under https
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, &$headers);
// Set the URL to be processed
curl_setopt($ch, CURLOPT_URL, $url);
// Set the callback functions
curl_setopt($ch, CURLOPT_WRITEFUNCTION, write_callback);
// Set the data to be send
global $data;
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Debug, however...
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$result = curl_exec($ch);
if ($result == CURL_OK) {
//print_r(curl_getinfo($ch));
} else {
echo "\n\n-------------------------\n" .
"cURL error number:" .
curl_errno($ch);
echo "\n\ncURL error:" . curl_error($ch);
}
curl_close($ch);
return;
}
sendCommand();
?>
 
Back
Top