mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-26 01:05:38 +00:00
Use procedural code for example snippet
This commit is contained in:
parent
a34302c88a
commit
362f895668
1 changed files with 8 additions and 20 deletions
|
|
@ -89,29 +89,17 @@ fetch("http://localhost:8080", requestOptions)
|
||||||
|
|
||||||
* `PHP` (Symfony HttpClient)
|
* `PHP` (Symfony HttpClient)
|
||||||
```php
|
```php
|
||||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
$httpClient = HttpClient::create();
|
||||||
|
|
||||||
class XrechnungValidator
|
$response = $this->httpClient->request('POST', 'http://localhost:8080', [
|
||||||
{
|
'headers' => [
|
||||||
private $httpClient;
|
'Content-Type' => 'application/xml',
|
||||||
|
],
|
||||||
|
'body' => fopen('/path/to/some.xml', 'r'),
|
||||||
|
]);
|
||||||
|
|
||||||
public function __construct(HttpClientInterface $httpClient)
|
echo $response->getContent();
|
||||||
{
|
|
||||||
$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
|
## Status codes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue