Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML Form Support: libsoup Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="libsoup Reference Manual">
<link rel="up" href="ch04.html" title="Web Services APIs">
<link rel="prev" href="ch04.html" title="Web Services APIs">
<link rel="next" href="libsoup-2.4-XMLRPC-Support.html" title="XMLRPC Support">
<meta name="generator" content="GTK-Doc V1.28.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#libsoup-2.4-HTML-Form-Support.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch04.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ch04.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="libsoup-2.4-XMLRPC-Support.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="libsoup-2.4-HTML-Form-Support"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libsoup-2.4-HTML-Form-Support.top_of_page"></a>HTML Form Support</span></h2>
<p>HTML Form Support — HTML form handling</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">GHashTable</span> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode" title="soup_form_decode ()">soup_form_decode</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GHashTable</span> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode-multipart" title="soup_form_decode_multipart ()">soup_form_decode_multipart</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">char</span> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode" title="soup_form_encode ()">soup_form_encode</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">char</span> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-datalist" title="soup_form_encode_datalist ()">soup_form_encode_datalist</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">char</span> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-hash" title="soup_form_encode_hash ()">soup_form_encode_hash</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">char</span> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-valist" title="soup_form_encode_valist ()">soup_form_encode_valist</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new" title="soup_form_request_new ()">soup_form_request_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new-from-datalist" title="soup_form_request_new_from_datalist ()">soup_form_request_new_from_datalist</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new-from-hash" title="soup_form_request_new_from_hash ()">soup_form_request_new_from_hash</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *
</td>
<td class="function_name">
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new-from-multipart" title="soup_form_request_new_from_multipart ()">soup_form_request_new_from_multipart</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libsoup-2.4-HTML-Form-Support.html#SOUP-FORM-MIME-TYPE-MULTIPART:CAPS" title="SOUP_FORM_MIME_TYPE_MULTIPART">SOUP_FORM_MIME_TYPE_MULTIPART</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="libsoup-2.4-HTML-Form-Support.html#SOUP-FORM-MIME-TYPE-URLENCODED:CAPS" title="SOUP_FORM_MIME_TYPE_URLENCODED">SOUP_FORM_MIME_TYPE_URLENCODED</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;libsoup/soup.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.description"></a><h2>Description</h2>
<p>libsoup contains several help methods for processing HTML forms as
defined by <a class="ulink" href="http://www.w3.org/TR/html401/interact/forms.html#h-17.13" target="_top">the
HTML 4.01 specification</a>.</p>
</div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="soup-form-decode"></a><h3>soup_form_decode ()</h3>
<pre class="programlisting"><span class="returnvalue">GHashTable</span> *
soup_form_decode (<em class="parameter"><code>const <span class="type">char</span> *encoded_form</code></em>);</pre>
<p>Decodes <em class="parameter"><code>form</code></em>
, which is an urlencoded dataset as defined in the
HTML 4.01 spec.</p>
<div class="refsect3">
<a name="soup-form-decode.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>encoded_form</p></td>
<td class="parameter_description"><p>data of type "application/x-www-form-urlencoded"</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-decode.returns"></a><h4>Returns</h4>
<p>a hash
table containing the name/value pairs from <em class="parameter"><code>encoded_form</code></em>
, which you
can free with <code class="function">g_hash_table_destroy()</code>. </p>
<p><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 utf8][<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-decode-multipart"></a><h3>soup_form_decode_multipart ()</h3>
<pre class="programlisting"><span class="returnvalue">GHashTable</span> *
soup_form_decode_multipart (<em class="parameter"><code><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a> *msg</code></em>,
                            <em class="parameter"><code>const <span class="type">char</span> *file_control_name</code></em>,
                            <em class="parameter"><code><span class="type">char</span> **filename</code></em>,
                            <em class="parameter"><code><span class="type">char</span> **content_type</code></em>,
                            <em class="parameter"><code><a class="link" href="SoupMessageBody.html#SoupBuffer"><span class="type">SoupBuffer</span></a> **file</code></em>);</pre>
<p>Decodes the "multipart/form-data" request in <em class="parameter"><code>msg</code></em>
; this is a
convenience method for the case when you have a single file upload
control in a form. (Or when you don't have any file upload
controls, but are still using "multipart/form-data" anyway.) Pass
the name of the file upload control in <em class="parameter"><code>file_control_name</code></em>
, and
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode-multipart" title="soup_form_decode_multipart ()"><code class="function">soup_form_decode_multipart()</code></a> will extract the uploaded file data
into <em class="parameter"><code>filename</code></em>
, <em class="parameter"><code>content_type</code></em>
, and <em class="parameter"><code>file</code></em>
. All of the other form
control data will be returned (as strings, as with
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode" title="soup_form_decode ()"><code class="function">soup_form_decode()</code></a>) in the returned <span class="type">GHashTable</span>.</p>
<p>You may pass <code class="literal">NULL</code> for <em class="parameter"><code>filename</code></em>
, <em class="parameter"><code>content_type</code></em>
 and/or <em class="parameter"><code>file</code></em>
 if you do not
care about those fields. <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-decode-multipart" title="soup_form_decode_multipart ()"><code class="function">soup_form_decode_multipart()</code></a> may also
return <code class="literal">NULL</code> in those fields if the client did not provide that
information. You must free the returned filename and content-type
with <code class="function">g_free()</code>, and the returned file data with <a class="link" href="SoupMessageBody.html#soup-buffer-free" title="soup_buffer_free ()"><code class="function">soup_buffer_free()</code></a>.</p>
<p>If you have a form with more than one file upload control, you will
need to decode it manually, using <a class="link" href="SoupMultipart.html#soup-multipart-new-from-message" title="soup_multipart_new_from_message ()"><code class="function">soup_multipart_new_from_message()</code></a>
and <a class="link" href="SoupMultipart.html#soup-multipart-get-part" title="soup_multipart_get_part ()"><code class="function">soup_multipart_get_part()</code></a>.</p>
<div class="refsect3">
<a name="soup-form-decode-multipart.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>msg</p></td>
<td class="parameter_description"><p>a <a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a> containing a "multipart/form-data" request body</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>file_control_name</p></td>
<td class="parameter_description"><p>the name of the HTML file upload control, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>filename</p></td>
<td class="parameter_description"><p>return location for the name of the uploaded file, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>content_type</p></td>
<td class="parameter_description"><p>return location for the MIME type of the uploaded file, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>file</p></td>
<td class="parameter_description"><p>return location for the uploaded file data, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-decode-multipart.returns"></a><h4>Returns</h4>
<p>a hash table containing the name/value pairs (other than
<em class="parameter"><code>file_control_name</code></em>
) from <em class="parameter"><code>msg</code></em>
, which you can free with
<code class="function">g_hash_table_destroy()</code>. On error, it will return <code class="literal">NULL</code>. </p>
<p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 utf8][<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>]</span></p>
</div>
<p class="since">Since: 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-encode"></a><h3>soup_form_encode ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *
soup_form_encode (<em class="parameter"><code>const <span class="type">char</span> *first_field</code></em>,
                  <em class="parameter"><code>...</code></em>);</pre>
<p>Encodes the given field names and values into a value of type
"application/x-www-form-urlencoded", as defined in the HTML 4.01
spec.</p>
<p>This method requires you to know the names of the form fields (or
at the very least, the total number of fields) at compile time; for
working with dynamic forms, use <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-hash" title="soup_form_encode_hash ()"><code class="function">soup_form_encode_hash()</code></a> or
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-datalist" title="soup_form_encode_datalist ()"><code class="function">soup_form_encode_datalist()</code></a>.</p>
<div class="refsect3">
<a name="soup-form-encode.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>first_field</p></td>
<td class="parameter_description"><p>name of the first form field</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>value of <em class="parameter"><code>first_field</code></em>
, followed by additional field names
and values, terminated by <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-encode.returns"></a><h4>Returns</h4>
<p> the encoded form</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-encode-datalist"></a><h3>soup_form_encode_datalist ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *
soup_form_encode_datalist (<em class="parameter"><code><span class="type">GData</span> **form_data_set</code></em>);</pre>
<p>Encodes <em class="parameter"><code>form_data_set</code></em>
 into a value of type
"application/x-www-form-urlencoded", as defined in the HTML 4.01
spec. Unlike <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-hash" title="soup_form_encode_hash ()"><code class="function">soup_form_encode_hash()</code></a>, this preserves the ordering
of the form elements, which may be required in some situations.</p>
<div class="refsect3">
<a name="soup-form-encode-datalist.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>form_data_set</p></td>
<td class="parameter_description"><p>a datalist containing name/value pairs</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-encode-datalist.returns"></a><h4>Returns</h4>
<p> the encoded form</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-encode-hash"></a><h3>soup_form_encode_hash ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *
soup_form_encode_hash (<em class="parameter"><code><span class="type">GHashTable</span> *form_data_set</code></em>);</pre>
<p>Encodes <em class="parameter"><code>form_data_set</code></em>
 into a value of type
"application/x-www-form-urlencoded", as defined in the HTML 4.01
spec.</p>
<p>Note that the HTML spec states that "The control names/values are
listed in the order they appear in the document." Since this method
takes a hash table, it cannot enforce that; if you care about the
ordering of the form fields, use <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode-datalist" title="soup_form_encode_datalist ()"><code class="function">soup_form_encode_datalist()</code></a>.</p>
<div class="refsect3">
<a name="soup-form-encode-hash.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>form_data_set</p></td>
<td class="parameter_description"><p>a hash table containing
name/value pairs (as strings). </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 utf8]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-encode-hash.returns"></a><h4>Returns</h4>
<p> the encoded form</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-encode-valist"></a><h3>soup_form_encode_valist ()</h3>
<pre class="programlisting"><span class="returnvalue">char</span> *
soup_form_encode_valist (<em class="parameter"><code>const <span class="type">char</span> *first_field</code></em>,
                         <em class="parameter"><code><span class="type">va_list</span> args</code></em>);</pre>
<p>See <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode" title="soup_form_encode ()"><code class="function">soup_form_encode()</code></a>. This is mostly an internal method, used by
various other methods such as <a class="link" href="SoupURI.html#soup-uri-set-query-from-fields" title="soup_uri_set_query_from_fields ()"><code class="function">soup_uri_set_query_from_fields()</code></a> and
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new" title="soup_form_request_new ()"><code class="function">soup_form_request_new()</code></a>.</p>
<div class="refsect3">
<a name="soup-form-encode-valist.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>first_field</p></td>
<td class="parameter_description"><p>name of the first form field</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>args</p></td>
<td class="parameter_description"><p>pointer to additional values, as in <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-encode" title="soup_form_encode ()"><code class="function">soup_form_encode()</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-encode-valist.returns"></a><h4>Returns</h4>
<p> the encoded form</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-request-new"></a><h3>soup_form_request_new ()</h3>
<pre class="programlisting"><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *
soup_form_request_new (<em class="parameter"><code>const <span class="type">char</span> *method</code></em>,
                       <em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                       <em class="parameter"><code>const <span class="type">char</span> *first_field</code></em>,
                       <em class="parameter"><code>...</code></em>);</pre>
<p>Creates a new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a> and sets it up to send the given data
to <em class="parameter"><code>uri</code></em>
 via <em class="parameter"><code>method</code></em>
. (That is, if <em class="parameter"><code>method</code></em>
 is "GET", it will encode
the form data into <em class="parameter"><code>uri</code></em>
's query field, and if <em class="parameter"><code>method</code></em>
 is "POST", it
will encode it into the <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>'s request_body.)</p>
<div class="refsect3">
<a name="soup-form-request-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>method</p></td>
<td class="parameter_description"><p>the HTTP method, either "GET" or "POST"</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description"><p>the URI to send the form data to</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>first_field</p></td>
<td class="parameter_description"><p>name of the first form field</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>value of <em class="parameter"><code>first_field</code></em>
, followed by additional field names
and values, terminated by <code class="literal">NULL</code>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-request-new.returns"></a><h4>Returns</h4>
<p>the new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-request-new-from-datalist"></a><h3>soup_form_request_new_from_datalist ()</h3>
<pre class="programlisting"><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *
soup_form_request_new_from_datalist (<em class="parameter"><code>const <span class="type">char</span> *method</code></em>,
                                     <em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                     <em class="parameter"><code><span class="type">GData</span> **form_data_set</code></em>);</pre>
<p>Creates a new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a> and sets it up to send <em class="parameter"><code>form_data_set</code></em>
 to
<em class="parameter"><code>uri</code></em>
 via <em class="parameter"><code>method</code></em>
, as with <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new" title="soup_form_request_new ()"><code class="function">soup_form_request_new()</code></a>.</p>
<div class="refsect3">
<a name="soup-form-request-new-from-datalist.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>method</p></td>
<td class="parameter_description"><p>the HTTP method, either "GET" or "POST"</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description"><p>the URI to send the form data to</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>form_data_set</p></td>
<td class="parameter_description"><p>the data to send to <em class="parameter"><code>uri</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-request-new-from-datalist.returns"></a><h4>Returns</h4>
<p>the new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-request-new-from-hash"></a><h3>soup_form_request_new_from_hash ()</h3>
<pre class="programlisting"><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *
soup_form_request_new_from_hash (<em class="parameter"><code>const <span class="type">char</span> *method</code></em>,
                                 <em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                 <em class="parameter"><code><span class="type">GHashTable</span> *form_data_set</code></em>);</pre>
<p>Creates a new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a> and sets it up to send <em class="parameter"><code>form_data_set</code></em>
 to
<em class="parameter"><code>uri</code></em>
 via <em class="parameter"><code>method</code></em>
, as with <a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new" title="soup_form_request_new ()"><code class="function">soup_form_request_new()</code></a>.</p>
<div class="refsect3">
<a name="soup-form-request-new-from-hash.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>method</p></td>
<td class="parameter_description"><p>the HTTP method, either "GET" or "POST"</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description"><p>the URI to send the form data to</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>form_data_set</p></td>
<td class="parameter_description"><p>the data to send to <em class="parameter"><code>uri</code></em>
. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8 utf8]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-request-new-from-hash.returns"></a><h4>Returns</h4>
<p>the new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="soup-form-request-new-from-multipart"></a><h3>soup_form_request_new_from_multipart ()</h3>
<pre class="programlisting"><a class="link" href="SoupMessage.html" title="SoupMessage"><span class="returnvalue">SoupMessage</span></a> *
soup_form_request_new_from_multipart (<em class="parameter"><code>const <span class="type">char</span> *uri</code></em>,
                                      <em class="parameter"><code><a class="link" href="SoupMultipart.html" title="SoupMultipart"><span class="type">SoupMultipart</span></a> *multipart</code></em>);</pre>
<p>Creates a new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a> and sets it up to send <em class="parameter"><code>multipart</code></em>
 to
<em class="parameter"><code>uri</code></em>
 via POST.</p>
<p>To send a <code class="literal">"multipart/form-data"</code> POST, first
create a <a class="link" href="SoupMultipart.html" title="SoupMultipart"><span class="type">SoupMultipart</span></a>, using <a class="link" href="libsoup-2.4-HTML-Form-Support.html#SOUP-FORM-MIME-TYPE-MULTIPART:CAPS" title="SOUP_FORM_MIME_TYPE_MULTIPART"><code class="literal">SOUP_FORM_MIME_TYPE_MULTIPART</code></a> as
the MIME type. Then use <a class="link" href="SoupMultipart.html#soup-multipart-append-form-string" title="soup_multipart_append_form_string ()"><code class="function">soup_multipart_append_form_string()</code></a> and
<a class="link" href="SoupMultipart.html#soup-multipart-append-form-file" title="soup_multipart_append_form_file ()"><code class="function">soup_multipart_append_form_file()</code></a> to add the value of each form
control to the multipart. (These are just convenience methods, and
you can use <a class="link" href="SoupMultipart.html#soup-multipart-append-part" title="soup_multipart_append_part ()"><code class="function">soup_multipart_append_part()</code></a> if you need greater
control over the part headers.) Finally, call
<a class="link" href="libsoup-2.4-HTML-Form-Support.html#soup-form-request-new-from-multipart" title="soup_form_request_new_from_multipart ()"><code class="function">soup_form_request_new_from_multipart()</code></a> to serialize the multipart
structure and create a <a class="link" href="SoupMessage.html" title="SoupMessage"><span class="type">SoupMessage</span></a>.</p>
<div class="refsect3">
<a name="soup-form-request-new-from-multipart.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description"><p>the URI to send the form data to</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>multipart</p></td>
<td class="parameter_description"><p>a "multipart/form-data" <a class="link" href="SoupMultipart.html" title="SoupMultipart"><span class="type">SoupMultipart</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="soup-form-request-new-from-multipart.returns"></a><h4>Returns</h4>
<p>the new <a class="link" href="SoupMessage.html" title="SoupMessage"><code class="literal">SoupMessage</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: 2.26</p>
</div>
</div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="SOUP-FORM-MIME-TYPE-MULTIPART:CAPS"></a><h3>SOUP_FORM_MIME_TYPE_MULTIPART</h3>
<pre class="programlisting">#define SOUP_FORM_MIME_TYPE_MULTIPART  "multipart/form-data"
</pre>
<p>A macro containing the value
<code class="literal">"multipart/form-data"</code>; the MIME type used for
posting form data that contains files to be uploaded.</p>
<p class="since">Since: 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="SOUP-FORM-MIME-TYPE-URLENCODED:CAPS"></a><h3>SOUP_FORM_MIME_TYPE_URLENCODED</h3>
<pre class="programlisting">#define SOUP_FORM_MIME_TYPE_URLENCODED "application/x-www-form-urlencoded"
</pre>
<p>A macro containing the value
<code class="literal">"application/x-www-form-urlencoded"</code>; the default
MIME type for POSTing HTML form data.</p>
<p class="since">Since: 2.26</p>
</div>
</div>
<div class="refsect1">
<a name="libsoup-2.4-HTML-Form-Support.see-also"></a><h2>See Also</h2>
<p><a class="link" href="SoupMultipart.html" title="SoupMultipart"><span class="type">SoupMultipart</span></a></p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.28.1</div>
</body>
</html>