Curlopt_postfields

Learn how to use CURLOPT_POSTFIELDS to send data to a server in an HTTP POST or an MQTT subscribe operation. See examples, syntax, description, and availability of this option. 1 curlopt_returntransfer 2 curl php 3 curl_exec 4 curl_setopt php 5 CURLOPT_POSTFIELDS. The full data to post in a HTTP "POST" operation. To post a file, prepend a filename with @ and use the full path. The filetype can be explicitly specified by following the filename with the type in the format ';type=mimetype'. 6 curl POST format for CURLOPT 7 CURLOPT 8 curl POST format for CURLOPT 9 CURLOPT_POSTFIELDS will set CURLOPT_POST to true for you, no need for repeat. If you really need to set both, then either: set CURLOPT_POST *before* CURLOPT_POSTFIELDS. 10

curlopt_postfields Using CURLOPT_POSTFIELDS (3) implies setting CURLOPT_POST (3) to 1. If CURLOPT_POSTFIELDS (3) is explicitly set to NULL then libcurl gets the POST data from the read callback. To send a zero-length (empty) POST, set CURLOPT_POSTFIELDS (3) to an empty string, or set CURLOPT_POST (3) to 1 and CURLOPT_POSTFIELDSIZE (3) to 0.