yourivw / LEClient

An easy-to-use PHP ACME v2 client library, designed to be used with LetsEncrypt.
MIT License
204 stars 98 forks source link

Fatal error: Uncaught RuntimeException: Invalid response, header #78

Closed turigeza closed 4 years ago

turigeza commented 5 years ago

Just following the first example on the readme I get the following error :

03-11-2019 18:22:03, function LEAccount __construct: No account found, attempting to create account.

What am I missing ?

Fatal error: Uncaught RuntimeException: Invalid response, header: HTTP/1.1 400 Bad Request Server: nginx Date: Sun, 03 Nov 2019 18:22:04 GMT Content-Type: application/problem+json Content-Length: 108 Connection: keep-alive Cache-Control: public, max-age=0, no-cache Link: https://acme-staging-v02.api.letsencrypt.org/directory;rel="index" Replay-Nonce: 0002C5BCX1a-YAkTXophgECLBtki0ecYjwYzGnN9jLuPR30 in /websites/aapi.younit.app/vendor/yourivw/leclient/src/LEConnector.php:156 Stack trace: #0 /websites/aapi.younit.app/vendor/yourivw/leclient/src/LEConnector.php(193): LEClient\LEConnector->request('POST', 'https://acme-st...', '{"protected":"e...') #1 /websites/aapi.younit.app/vendor/yourivw/leclient/src/LEAccount.php(98): LEClient\LEConnector->post('https://acme-st...', '{"protected":"e...') #2 /websites/aapi.younit.app/vendor/yourivw/leclient/src/LEAccount.php(76): LEClient\LEAccount->createLEAccount(Array) #3 /websites/aapi.younit.app/vendor/yourivw/leclient/src/LEClient.php(156): LEClient\LEAccount->__constru in /websites/aapi.younit.app/vendor/yourivw/leclient/src/LEConnector.php on line 156

My code is

require 'vendor/autoload.php';
use LEClient\LEClient;

require_once '_younit/before.php';

$rs = (function() use ($data) {
    $email = ['acme@younit.app'];
    // $client = new LEClient($email);
    // $client = new LEClient($email, true);
    $client = new LEClient($email, true, LECLient::LOG_STATUS);
    return true;
})();

require_once '_younit/after.php';