Add PHP example for using the HTTP daemon in docs.

This commit is contained in:
Stefan Blanke 2020-10-09 13:32:28 +02:00
parent 4a6200b055
commit a34302c88a

View file

@ -86,6 +86,34 @@ fetch("http://localhost:8080", requestOptions)
.then(result => console.log(result))
.catch(error => console.log('error', error));
```
* `PHP` (Symfony HttpClient)
```php
use Symfony\Contracts\HttpClient\HttpClientInterface;
class XrechnungValidator
{
private $httpClient;
public function __construct(HttpClientInterface $httpClient)
{
$this->httpClient = $httpClient;
}
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
| code | description |
|-|-|