From 14c689f058989cf5fb7dbe0f070d9b7e21171234 Mon Sep 17 00:00:00 2001 From: mohammad jalmoudy Date: Sat, 13 Dec 2025 23:23:38 +0330 Subject: [PATCH] add simple test data to use loaded Guzzle http client --- src/index.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/index.php diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..1939977 --- /dev/null +++ b/src/index.php @@ -0,0 +1,35 @@ +request('GET', 'https://api.github.com/repos/guzzle/guzzle'); +} catch (GuzzleException $e) { + echo $e->getMessage(); + return; +} + +echo $response->getStatusCode() . PHP_EOL; +echo $response->getHeaderLine('content-type') . PHP_EOL; +echo $response->getBody() . PHP_EOL; + +// asynchronous +$request = new Request('GET', 'https://httpbin.org'); + +$promise = $client + ->sendAsync($request) + ->then(function ($response) { + echo 'I completed! ' . $response->getBody(); + }); + +echo "before waiting for response" . PHP_EOL; + +$promise->wait(); + +echo "after waiting for response" . PHP_EOL; \ No newline at end of file