lib/Verifiers/Http01.php
public function verifyChallenge(string $domain, string $token, string $expectedPayload): Promise {
        return call(function () use ($domain, $token, $expectedPayload) {
            $uri = "http://{$domain}/.well-known/acme-challenge/{$token}";

            /** @var Response $response */
            $response = yield $this->client->request($uri);

            /** @var string $body */
            $body = yield $response->getBody();

            if (rtrim($expectedPayload) !== rtrim($body)) {
                throw new AcmeException("Verification failed, please check the response body for '{$uri}'. It contains '{$body}' but '{$expectedPayload}' was expected.");
            }
        });
    }
public function verifyChallenge(string $domain, string $token, string $expectedPayload): Promise {
        return call(function () use ($domain, $token, $expectedPayload) {
            $uri = "http://{$domain}/.well-known/acme-challenge/{$token}";

            /** @var Response $response */
            $response = yield $this->client->request($uri);

            /** @var string $body */
            $body = yield $response->getBody();

            if (rtrim($expectedPayload) !== rtrim($body)) {
                throw new AcmeException("Verification failed, please check the response body for '{$uri}'. It contains '{$body}' but '{$expectedPayload}' was expected.");
            }
        });
    }
public function verifyChallenge ( string $ domain , string $ token , string $ expectedPayload ) : Promise { return call ( function ( ) use ( $ domain , $ token , $ expectedPayload ) { $ uri = "http://{$domain}/.well-known/acme-challenge/{$token}" ; /** @var Response $response */ $ response = yield $ this -> client -> request ( $ uri ) ; /** @var string $body */ $ body = yield $ response -> getBody ( ) ; if ( rtrim ( $ expectedPayload ) !== rtrim ( $ body ) ) { throw new AcmeException ( "Verification failed, please check the response body for '{$uri}'. It contains '{$body}' but '{$expectedPayload}' was expected." ) ; } } ) ; }
Verifies a HTTP-01 challenge.

Can be used to verify a challenge before requesting validation from a CA to catch errors early.

@api

@param string $domain Domain to verify.
@param string $token Challenge token.
@param string $expectedPayload Expected payload.

@return Promise Resolves successfully if the challenge has been successfully verified, otherwise fails.
@throws AcmeException If the challenge could not be verified.
Verifies a HTTP - 01 challenge .