Join Justin Yost for an in-depth discussion in this video Sending request data, part of Consuming RESTful APIs in PHP with Guzzle.
- [Instructor] So what happens when we need to send data…with our request?…When you submit a form on the web,…it includes in the post request,…the data in the form as part of that request.…We need to do the same thing for our request.…In this case, we need to be able to submit…a new post request to create a new record on the server.…Open up your text editor to the first.php file…and copy the contents of that file.…By now, you should be an expert at this.…We'll create a new file.…
We'll save this file as data.php.…We'll paste in the contents from first.php,…and save the file.…First, what types of requests can include a request body?…Well, in fact every request type actually allows a body,…including a GET request.…However, semantically a body on a GET request…shouldn't mean anything.…A POST, PUT, or PATCH request is the correct request type…that allows for a body.…
In this case, we're going to use a POST request…to create a new record on the server.…In this case, we'll change line seven to instead of…being a GET to be POST.…
- 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 36m 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.