mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
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
This commit is contained in:
parent
4a6200b055
commit
6ac1346fa9
1 changed files with 16 additions and 0 deletions
|
|
@ -86,6 +86,22 @@ fetch("http://localhost:8080", requestOptions)
|
||||||
.then(result => console.log(result))
|
.then(result => console.log(result))
|
||||||
.catch(error => console.log('error', error));
|
.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
|
## Status codes
|
||||||
| code | description |
|
| code | description |
|
||||||
|-|-|
|
|-|-|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue