Join Justin Yost for an in-depth discussion in this video Sending query data, part of Consuming RESTful APIs in PHP with Guzzle.
- [Instructor] So what happens when we need…to send query data?…That is where we have as part of the URL,…the piece where we include a question mark…and any extra bits of data to tell the site,…hey, here is some extra information for my request.…Let's try this out.…First, we'll open up the first .php file.…Copy the contents of it.…And then we'll create a new file.…Save it as query.php…and paste it in.…Now we can do some basic queries.…
The simplest way to form a query string…is to just include the query string…as part of the URL for the request.…We can edit the URL on line 8 to read as /posts…then include our ?userId=1.…In other words, we're going to do a search…to find all the posts where the userId is equal to 1.…We can save this,…go to our command line…and run it using the command php query.php.…
And there we go, pretty easy.…But that's really not the best way…to be forming these queries.…Very rarely are we going to hardcode the URL…with the specific parameters we need.…Instead, we need to be able to build…and present these parameters on the fly.…
- 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.