From 362f895668b6d13e9cd9db095f5a03ce46f44027 Mon Sep 17 00:00:00 2001 From: Stefan Blanke Date: Mon, 12 Oct 2020 17:37:44 +0200 Subject: [PATCH] Use procedural code for example snippet --- docs/daemon.md | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/docs/daemon.md b/docs/daemon.md index 5730d7a..c357a0a 100644 --- a/docs/daemon.md +++ b/docs/daemon.md @@ -89,29 +89,17 @@ fetch("http://localhost:8080", requestOptions) * `PHP` (Symfony HttpClient) ```php -use Symfony\Contracts\HttpClient\HttpClientInterface; +$httpClient = HttpClient::create(); -class XrechnungValidator -{ - private $httpClient; +$response = $this->httpClient->request('POST', 'http://localhost:8080', [ + 'headers' => [ + 'Content-Type' => 'application/xml', + ], + 'body' => fopen('/path/to/some.xml', 'r'), +]); - public function __construct(HttpClientInterface $httpClient) - { - $this->httpClient = $httpClient; - } +echo $response->getContent(); - public function validate() - { - $response = $this->httpClient->request('POST', 'http://localhost:8080', [ - 'headers' => [ - 'Content-Type' => 'application/xml', - ], - 'body' => fopen('/path/to/some.xml', 'r'), - ]); - - echo $response->getContent(); - } -} ``` ## Status codes