Join Justin Yost for an in-depth discussion in this video PSR-7 bodies, part of Consuming RESTful APIs in PHP with Guzzle.
- [Instructor] Now that we've seen how to process a request…and a response, let's now see the PSR-7 bodies.…To do this, we'll open up the first file…and copy it, and we'll create a new file,…label it PSR seven body dot PHP,…and we'll paste in the contents from first in here.…The body of the message, of course, we've seen…that we can read the entire body all at once.…But if we wanted to pull off, say,…the first 20 bytes from the message?…Can we do that?…Why, indeed, we can.…
Let's update line 12 to read as echo response get body.…In this case, we'll call a method off of our get body,…read, and pass in the number of bytes we want to read.…In this case, 20.…We'll also go ahead and add on here our new line.…So we'll add in period, and then in double quotes,…backslash R, backslash N.…Let's save this file and go to our terminal application,…and we'll run the command PHP PSR seven body dot PHP.…
And now you'll see that we've only read the first 20 bytes.…We get the user ID and its value,…and then we get the first quote…
- 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.