lib/AcmeClient.php
public function get(string $resource): Promise {
        return call(function () use ($resource) {
            $uri = yield $this->getResourceUri($resource);

            $this->logger->debug('Requesting {uri} via GET', [
                'uri' => $uri,
            ]);

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

                // We just buffer the body here, so no further I/O will happen once this method's promise resolves.
                $body = yield $response->getBody();

                $this->logger->debug('Request for {uri} via GET has been processed with status {status}: {body}', [
                    'uri' => $uri,
                    'status' => $response->getStatus(),
                    'body' => $body
                ]);

                $this->saveNonce($response);
            } catch (Throwable $e) {
                throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e);
            } catch (Exception $e) {
                throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e);
            }

            return $response;
        });
    }
public function get(string $resource): Promise {
        return call(function () use ($resource) {
            $uri = yield $this->getResourceUri($resource);

            $this->logger->debug('Requesting {uri} via GET', [
                'uri' => $uri,
            ]);

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

                // We just buffer the body here, so no further I/O will happen once this method's promise resolves.
                $body = yield $response->getBody();

                $this->logger->debug('Request for {uri} via GET has been processed with status {status}: {body}', [
                    'uri' => $uri,
                    'status' => $response->getStatus(),
                    'body' => $body
                ]);

                $this->saveNonce($response);
            } catch (Throwable $e) {
                throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e);
            } catch (Exception $e) {
                throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e);
            }

            return $response;
        });
    }
public function get ( string $ resource ) : Promise { return call ( function ( ) use ( $ resource ) { $ uri = yield $ this -> getResourceUri ( $ resource ) ; $ this -> logger -> debug ( 'Requesting {uri} via GET' , [ 'uri' => $ uri , ] ) ; try { /** @var Response $response */ $ response = yield $ this -> http -> request ( $ uri ) ; // We just buffer the body here, so no further I/O will happen once this method's promise resolves. $ body = yield $ response -> getBody ( ) ; $ this -> logger -> debug ( 'Request for {uri} via GET has been processed with status {status}: {body}' , [ 'uri' => $ uri , 'status' => $ response -> getStatus ( ) , 'body' => $ body ] ) ; $ this -> saveNonce ( $ response ) ; } catch ( Throwable $ e ) { throw new AcmeException ( "GET request to {$uri} failed: " . $ e -> getMessage ( ) , null , $ e ) ; } catch ( Exception $ e ) { throw new AcmeException ( "GET request to {$uri} failed: " . $ e -> getMessage ( ) , null , $ e ) ; } return $ response ; } ) ; }
Retrieves a resource using a GET request.

@api

@param string $resource Resource to fetch.

@return Promise Resolves to the HTTP response.
@throws AcmeException If the request failed.
Retrieves a resource using a GET request .