File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,22 @@ Create a file ``demo.php`` in the root folder and write the following code::
40
40
<?php
41
41
require('vendor/autoload.php');
42
42
43
- TODO: create client instance with discovery and do some requests
43
+ use Http\Discovery\HttpClientDiscovery;
44
+ use Http\Discovery\MessageFactoryDiscovery;
44
45
46
+ $client = HttpClientDiscovery::find();
47
+ $messageFactory = MessageFactoryDiscovery::find();
48
+ $homeResponse = $client->sendRequest(
49
+ $messageFactory->createRequest('GET', 'http://httplug.io')
50
+ );
51
+
52
+ var_dump($homeResponse->getStatusCode()); // 200, hopefully
53
+
54
+ $missingPageResponse = $client->sendRequest(
55
+ $messageFactory->createRequest('GET', 'http://httplug.io/missingPage')
56
+ );
57
+
58
+ var_dump($missingPageResponse->getStatusCode()); // 404
45
59
46
60
Using an Asynchronous Client
47
61
----------------------------
You can’t perform that action at this time.
0 commit comments