PHP code example of londry / trustoceanssl-composer-library

1. Go to this page and download the library: Download londry/trustoceanssl-composer-library library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

londry / trustoceanssl-composer-library example snippets


composer 

$newSslOrder = new SslOrder('[email protected]','ApiToken-replace-this-to-your-own');

$newSslOrder->setCertificateType(CertificateType::TrustOceanEncryption365Ssl);
$newSslOrder->setCertificatePeriod(CertificatePeriod::ThreeMonths);
$newSslOrder->setUniqueId('someUniqueStringHere');
$newSslOrder->setDomains(['example1.com','example2.com','example3.com','www.example3.com']);
$newSslOrder->setCsrCode(new Csr($request->get('-----BEGIN CERTIFICATE REQUEST----- MIIDADCCAegCAQAwgboxCzAJBgNVBAYTAkNOMRAwDgYDVQQIDAdTaGFhbnhpMQ0w CwYDVQQHDAR4aWFuMScwJQYDVQQKDB5UcnVzdE9jZWFuIENvcnBvcmF0aW9uIExp bWl0ZWQxJzAlBgNVBAsMHlRydXN0T2NlYW4gQ29ycG9yYXRpb24gTGltaXRlZDEV MBMGA1UEAwwMZXhhbXBsZTEuY29tMSEwHwYJKoZIhvcNAQkBFhJkZXYtYXBpQHFp YW9rci5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDgqiV7NBxX 0J+DEqiez/mo+ZIEYZjbY3HbD1BqoV6tl85K0Me9vwodSVl1jCNzI8aH/QkFRhai CCcdkbTmuIG9rlXP9YP9MDMI8LS1z18WPy+FLNojxOjwBM6HV9tLHqAxWm9GLi9c 9JBHKNwlehLu9Zp9TjnSyrR0fBKqinS0kWRk3kYjl6Afj4qhfGV5lWtqapffoLr/ sdbp+pAhGEKw/9hU5OlX46+DORLr19qznoaez3KswejfNhlCIp6Cm5YiVoQEPvlu rioe9BJXjQC5MF8brt7IuM0PClerUDwwZ3EAz2xR8JJvQVppu2CRdtKoVPpCr2hf zC6GEBiTb+LPAgMBAAGgADANBgkqhkiG9w0BAQUFAAOCAQEAIClbOKNVB/f4Gqm9 xZ5ky/PBoGps5yfp8Ezw8IitjiX7SJFtNCXrXK7g1X6pfs6EMf2RyL1PPlJbO4+9 dEiG0faitbJ5+314WMBDIylmhSK2AILncqZvefQjrSmRNEr7Dy4JlpTM9qawJsYq /Qx1kGgss6M6CoYzg75eHueOKRv88nGzmr6/m7lIHxK5Ihrr5AtGj83OyFvucfB6 DPv+1XZP7+EpiehoyWzoA3UzLBpfSppVtnYo4oBBujF8DrBBPsaauPt59uBN1B3h 2GB+Ce3NHpAFI/x730dTj1Cdpy/xV8Ew9yBQki2Ojhzw5Ehl6yoXOnFMj0Ja0Lme nMVDKQ== -----END CERTIFICATE REQUEST-----')));
$newSslOrder->setDcvMethod(['dns','http','https','[email protected]']);
$newSslOrder->setContactEmail('[email protected]');
# Call CA
$newSsl = $newSslOrder->callInit(NULL)->callCreate();
# Get Domain Validation Information and Order ID
$dcvInfo = $newSsl->getDcvInfo();
$orderId = $newSsl->getOrderId();

$sslOrder = $newSslOrder->callInit($orderId);
$sslOrderStatus = $sslOrder->getOrderStatus();
if($sslOrderStatus === "issued_active"){
    $certificate_content = $sslOrder->getCertCode(); # will be PEM content
    $ca_certificate_content = $sslOrder->getCaCode(); # will be PEM content
}

callReissue();
callChangeDcvMethod($domainName, $newMethod);
callRemoveDomainName($unverifiedDomainName);
callRetryDcvProcess();
callResendDcvEmails();
callGetDcvDetails();
callRevokeCertificate($revocationReason);
callCancelAndRevokeCertificate();