1 | <?php |
||
2 | //Sets the maximum execution time to two minutes, to be sure. |
||
3 | ini_set('max_execution_time', 120); |
||
4 | // Including the LetsEncrypt Client. |
||
5 | require_once('LEClient/LEClient.php'); |
||
6 | |||
7 | // Listing the contact information in case a new account has to be created. |
||
8 | $email = array('[email protected]'); |
||
9 | // Defining the base name for this order |
||
10 | $basename = 'example.org'; |
||
11 | // Listing the domains to be included on the certificate |
||
12 | $domains = array('example.org', 'test.example.org'); |
||
13 | |||
14 | // Initiating the client instance. In this case using the staging server (argument 2) and outputting all status and debug information (argument 3). |
||
15 | $client = new LEClient($email, true, LECLient::LOG_STATUS); |
||
16 | // Initiating the order instance. The keys and certificate will be stored in /example.org/ (argument 1) and the domains in the array (argument 2) will be on the certificate. |
||
17 | $order = $client->getOrCreateOrder($basename, $domains); |
||
18 | // Check whether there are any authorizations pending. If that is the case, try to verify the pending authorizations. |
||
19 | if(!$order->allAuthorizationsValid()) |
||
20 | { |
||
21 | // Get the DNS challenges from the pending authorizations. |
||
22 | $pending = $order->getPendingAuthorizations(LEOrder::CHALLENGE_TYPE_DNS); |
||
23 | // Walk the list of pending authorization DNS challenges. |
||
24 | if(!empty($pending)) |
||
25 | { |
||
26 | foreach($pending as $challenge) |
||
27 | { |
||
28 | // For the purpose of this example, a fictitious functions creates or updates the ACME challenge DNS record for this domain. |
||
29 | setDNSRecord($challenge['identifier'], $challenge['DNSDigest']) |
||
30 | } |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
31 | } |
||
32 | } |
||
33 | ?> |