• 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.

Question Plesk API - retrieve attributes of SSL certificate for domain

Oleksander

New Pleskian
Hi, All!

Please help - I can't retrieve SSL-certificete attributes through Plesk API.

I run request XML request:
<packet>
<certificate>
<get-pool>
<filter>

<domain-name>your-domain-name.com</domain-name>
</filter>
</get-pool>
</certificate>
</packet>


And get XML response:
<packet version="1.6.7.0">
<certificate>
<get-pool>
<result>

<status>ok</status>
<filter-id>
your-domain-name.com</filter-id>
<id>your-cert-id-number</id>

<certificates/>
</result>
</get-pool>
</certificate
</packet>


But I need retrieve additional attributes - start date, expiry date and others.

Can I do this through Plesk API?
 
You can grab it with PHP;

Code:
<?
    $url = "https://www.google.com";
    $orignal_parse = parse_url($url, PHP_URL_HOST);
    $get = stream_context_create(array("ssl" => array("capture_peer_cert" => TRUE)));
    $read = stream_socket_client("ssl://".$orignal_parse.":443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $get);
    $cert = stream_context_get_params($read);
    $certinfo = openssl_x509_parse($cert['options']['ssl']['peer_certificate']);

    echo '<pre>';
    print_r($certinfo);
    echo '</pre>';
?>
 
Back
Top