etlegacy-libs/curl/docs/libcurl/opts/CURLOPT_HTTPPOST.html
2016-09-16 06:35:46 +02:00

96 lines
3.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>CURLOPT_HTTPPOST man page</title>
<meta name="generator" content="roffit">
<STYLE type="text/css">
pre {
overflow: auto;
margin: 0;
}
P.level0, pre.level0 {
padding-left: 2em;
}
P.level1, pre.level1 {
padding-left: 4em;
}
P.level2, pre.level2 {
padding-left: 6em;
}
span.emphasis {
font-style: italic;
}
span.bold {
font-weight: bold;
}
span.manpage {
font-weight: bold;
}
h2.nroffsh {
background-color: #e0e0e0;
}
span.nroffip {
font-weight: bold;
font-size: 120%;
font-family: monospace;
}
p.roffit {
text-align: center;
font-size: 80%;
}
</STYLE>
</head><body>
<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
<p class="level0">CURLOPT_HTTPPOST - specify the multipart formpost content <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
<p class="level0"><pre class="level0">
&#35;include &lt;curl/curl.h&gt;
&nbsp;
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTPPOST,
&nbsp; struct curl_httppost *formpost);
</pre>
<a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
<p class="level0">Tells libcurl you want a multipart/formdata HTTP POST to be made and you instruct what data to pass on to the server in the <span Class="emphasis">formpost</span> argument. Pass a pointer to a linked list of curl_httppost structs as parameter. The easiest way to create such a list, is to use <span Class="emphasis">curl_formadd(3)</span> as documented. The data in this list must remain intact as long as the curl transfer is alive and is using it.
<p class="level0">Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with <a Class="emphasis" href="./CURLOPT_HTTPHEADER.html">CURLOPT_HTTPHEADER</a>.
<p class="level0">When setting <a Class="emphasis" href="./CURLOPT_HTTPPOST.html">CURLOPT_HTTPPOST</a>, it will automatically set <a Class="emphasis" href="./CURLOPT_NOBODY.html">CURLOPT_NOBODY</a> to 0. <a name="DEFAULT"></a><h2 class="nroffsh">DEFAULT</h2>
<p class="level0">NULL <a name="PROTOCOLS"></a><h2 class="nroffsh">PROTOCOLS</h2>
<p class="level0">HTTP <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2>
<p class="level0"><pre class="level0">
/* Fill in the file upload field. This makes libcurl load data from
&nbsp; the given file name when curl_easy_perform() is called. */
curl_formadd(&formpost,
&nbsp; &lastptr,
&nbsp; CURLFORM_COPYNAME, "sendfile",
&nbsp; CURLFORM_FILE, "postit2.c",
&nbsp; CURLFORM_END);
&nbsp;
/* Fill in the filename field */
curl_formadd(&formpost,
&nbsp; &lastptr,
&nbsp; CURLFORM_COPYNAME, "filename",
&nbsp; CURLFORM_COPYCONTENTS, "postit2.c",
&nbsp; CURLFORM_END);
&nbsp;
/* Fill in the submit field too, even if this is rarely needed */
curl_formadd(&formpost,
&nbsp; &lastptr,
&nbsp; CURLFORM_COPYNAME, "submit",
&nbsp; CURLFORM_COPYCONTENTS, "send",
&nbsp; CURLFORM_END);
</pre>
<p class="level0"><a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2>
<p class="level0">As long as HTTP is enabled <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
<p class="level0">Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
<p class="level0"><a Class="manpage" href="./CURLOPT_POSTFIELDS.html">CURLOPT_POSTFIELDS</a>, <a Class="manpage" href="./CURLOPT_POST.html">CURLOPT_POST</a>, <span Class="manpage">curl_formadd (3)</span>, <span Class="manpage">curl_formfree (3)</span><p class="roffit">
This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
</body></html>