Join Justin Yost for an in-depth discussion in this video Basic Guzzle responses, part of Consuming RESTful APIs in PHP with Guzzle.
- Thus far, we haven't worked with the responses we are…receiving from our API,…beyond simply echoing the body, and a few times, the status…code for the response.…So let's see what all we can get back from the responses.…To start, we'll begin like we have many times now,…by opening up the file first.php,…copying the contents of it,…and then we'll create a new file,…call it response.php,…and paste in the contents from first.php.…
So what we have already done, is echo the response body.…Now this body is a json response.…So let's first turn this response into something we can…work with in our php code.…On line 12, we'll edit the echo to instead save the body…of the response to a variable body.…Now this body is actually currently a psr7 stream.…For now, we'll ignore that,…as we're going to discuss streams much later on.…For now, we just need to get the string value of it.…
To get at the string,…we need to call the method get contents on the body.…So on line 13, we'll add string is equal to body,…and we'll call the method get contents.…
- 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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.