filmov
tv
Postman POST Request: How to use Postman to send form data to a PHP script

Показать описание
It can be a pain testing an API endpoint if you need to use an existing HTML form to send a request. It's easier to use a Postman POST Request so you can replay the request with the same or slightly different data without filling out a form each time.
In part of the Junior Developer Central "How to use Postman" series, this video will take you through how to use Postman to send POST data.
This Postman tutorial focuses on how to send a POST request with the Postman tool. We'll be sending the data to a PHP script so the default way to accept data with PHP is via the $_POST variable. This is usually populated by a request from a HTML form so we'll be emulating that behaviour using Postman.
In order to give a real world example the API will santise and return valid emails that are sent in the POST request body.
In reality the Postman POST Request you use can be sent to any script or API endpoint that you have - it simply removes the need to create or use a web page to generate the required data.
You could of course send a POST request using your browser with something like the FETCH API or possibly even use jQuery if you have that available. However, there are many benefits to using Postman including saving the request for re-use later and even using the script as part of an integration test later on.
I hope you find this Postman tutorial useful and be sure to check out some of the other walkthrough videos in the Junior Developer Central Postman series.
Related videos in the series:-
Комментарии