US: 800.995.PLUM UK: 0845.355.3330
- What is IVR?
- IVR Products & Services
- Free Consultation
- Plum IVR Surveys
- About Us
from the Plum Voice IVR Glossary
HTTP POST is a request made by a client to submit data or update resources on a web server via the HTTP protocol. In a web browser, it is commonly performed when submitting a form on a web page. POST is an action verb of the HTTP protocol that used instead of GET when the request is expected to alter resources on the server or cause side effects.
Structured data and multiple files can sent to the server as part of the request. For submitting data alone via HTTP POST, the same encoding format as used for query strings may be used in the body of the request. This is called URL encoding, and recognized by server by the Content-Type header value of
encodeURIComponent to assist with this process, and PHP provides the function
For sending binary data or multiple files using HTTP POST, another encoding format called
multipart/form-data exists. It follows the rules of multipart MIME streams and is described briefly in the HTML spec.
Let's say there is a script at
http://example.com/order.php which expects to be passed two variables by the names "fruit" and "size". Then a POST request to the server would look like the following:
POST /order.php HTTP/1.1 Host: example.com Content-Length: 21 Content-Type: application/x-www-form-urlencoded fruit=kiwi&size=large
<submit next="http://example.com/order.php" namelist="fruit size" method="post"/> <subdialog src="http://example.com/order.php" namelist="fruit size" method="post"/>
Say there is an audio recording in the variable
rec that should be submitted to the server instead. Because a recording is binary data, the default encoding type of
application/x-www-form-urlencoded will not work. In this case we would want the encoding type to be
multipart/form-data, so we change the above by adding an
<submit next="http://example.com/order.php" namelist="rec" method="post" enctype="multipart/form-data"/> <subdialog src="http://example.com/order.php" namelist="rec" method="post" enctype="multipart/form-data"/>
The server will receive the recording as if it were a file uploaded from a web browser.
For more information, see the Plum developer documentation, chapter 5, on "Data Exchange."
|© 2013 The Plum Group, Inc.|