Skip to content

Commit

Permalink
http_client: docs for http_client_get()
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Dec 21, 2020
1 parent b6a1088 commit 729340f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/modules/http_client/doc/http_client_admin.xml
Expand Up @@ -897,6 +897,35 @@ http_client_query("http://api.com/index.php",
# POST-Request
http_client_query("http://api.com/index.php", "src=$si",
"Content-Type: text/plain", "$var(result)");
...
</programlisting>
</example>
</section>
<section id="http_client.f.http_get">
<title>
<function moreinfo="none">http_client_get(url, body, hdrs, respv)</function>
</title>
<para>
Perform a HTTP GET request to "url", storing the response body
in the "respv" variable. The "body" and "hdrs" can be empty strings
to skip setting them. The first three parameters can contain
variables that are evaluated at runtime. The "respv" has to be
the name of a writable variable.
</para>
<para>
Note: usually HTTP GET requests should have no body, according to
specs the body in HTTP GET does not affect the response, but is
not explicitely forbidden.
</para>
<example>
<title><function>http_client_get()</function> usage</title>
<programlisting format="linespecific">
...
http_client_get("http://api.com/index.php?r_uri=$(ru{s.escape.param})&amp;f_uri=$(fu{s.escape.param})",
"", "X-Token: abc", "$var(result)");
switch ($rc) {
...
}
...
</programlisting>
</example>
Expand Down

0 comments on commit 729340f

Please sign in to comment.