Join Justin Yost for an in-depth discussion in this video Sending concurrent requests, part of Consuming RESTful APIs in PHP with Guzzle.
- [Narrator] Concurrent requests is the ability for us…to send multiple requests.…We do this by taking advantage of the asynchronous request…and basically creating an array of promises…that we can then execute, and this provides us…multiple concurrent requests.…To try this out, we'll open up our editor…to our async.php file.…We'll copy this whole file, and create a new file…labeled concurrent.php.…And we'll paste in the contents of our code…from async.php in here now.…
To begin with, we'll modify our requests…to add them to an array.…We'll copy lines eight through eleven,…and duplicate it for a second promise object.…We'll update line 12 to save that variable as promise 2.…We'll also change, on line 14, from accessing the posts…at ID 1, to instead access the post at ID two.…After this, we'll create an array of these promises.…
We'll add a few blank lines after line 15,…and on line 17 add promises…is going to be equal to an array,…where we'll pass in promise, promise 2.…Okay, great. We now have an array of promises.…
- Installing Guzzle
- Sending basic requests
- Sending asynchronous requests
- Sending concurrent requests
- Sending query data
- Sending request data
- Advanced Guzzle request options
- Reviewing basic Guzzle responses
- Processing response headers
- Reviewing PSR-7 requests, responses, bodies, and headers
Skill Level Intermediate
PHP: Clean URLs on Apache Serverwith David Powers1h 35m Intermediate
PHP: Managing Persistent Sessionswith David Powers2h 41m Intermediate
1. Guzzle Basics
2. Requests with Guzzle
3. Responses with Guzzle
4. Guzzle and PSR-7
5. Testing and Guzzle
Next steps1m 12s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.