From 6ac1346fa9bc4915b2ef56f622df37e98b39e8f6 Mon Sep 17 00:00:00 2001 From: Stefan Blanke Date: Mon, 12 Oct 2020 19:05:53 +0200 Subject: [PATCH] Add PHP example for using the HTTP daemon in docs. (#61) * Add PHP example for using the HTTP daemon in docs. * Use procedural code for example snippet * Remove this variable --- docs/daemon.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/daemon.md b/docs/daemon.md index e3f7996..d49af40 100644 --- a/docs/daemon.md +++ b/docs/daemon.md @@ -86,6 +86,22 @@ fetch("http://localhost:8080", requestOptions) .then(result => console.log(result)) .catch(error => console.log('error', error)); ``` + +* `PHP` (Symfony HttpClient) +```php +$httpClient = HttpClient::create(); + +$response = $httpClient->request('POST', 'http://localhost:8080', [ + 'headers' => [ + 'Content-Type' => 'application/xml', + ], + 'body' => fopen('/path/to/some.xml', 'r'), +]); + +echo $response->getContent(); + +``` + ## Status codes | code | description | |-|-|