|}
==Examples==
'''Example 1: Simple GET request. Attribute <code>status-only</code> is set to true and that is why only the response element is returned, no content.'''
'''Query:'''.<br/><pre class="brush:xquery">http:send-request(<http:request method='get' status-only='true'/>, 'http://www.basex.org')</pre><br/>
'''Result:'''<pre class="brush:xml"><http:response status="200" message="OK">
<http:header name="Date" value="Mon, 14 Mar 2011 20:55:53 GMT"/>
<http:header name="Content-Length" value="12671"/>
<http:header name="Expires" value="Mon, 14 Mar 2011 20:57:23 GMT"/>
<http:header name="Set-Cookie" value="fe_typo_user=d10c9552f9a784d1a73f8b6ebdf5ce63; path=/"/>
<http:header name="Connection" value="close"/>
<http:header name="Content-Type" value="text/html; charset=utf-8"/>
<http:header name="Server" value="Apache/2.2.16"/>
<http:header name="X-Powered-By" value="PHP/5.3.5"/>
<http:header name="Cache-Control" value="max-age=90"/>
<http:body media-type="text/html; charset=utf-8"/>
</http:response></pre>
'''Example 2: Retrieve google search home page. Tagsoup shall be in the class path in order to parse html.'''
'''Query:'''<br/><pre class="brush:xquery">http:send-request(<http:request method='get'/>, 'http://www.google.com')</pre><br/>
'''Result:'''
<pre class="brush:xml">
<http:response status="200" message="OK">
<http:header name="Date" value="Mon, 14 Mar 2011 22:03:25 GMT"/>
<http:header name="Transfer-Encoding" value="chunked"/>
<http:header name="Expires" value="-1"/>
<http:header name="X-XSS-Protection" value="1; mode=block"/>
<http:header name="Set-Cookie" value="NID=44=Hb575zZBVz3JsZmk7JTwpX7WQ7VODk-KQmbtyDnLawiHB7sIEScdRBD9apIqR8VjH1MexPV4OABBdr1CBm0Ku-1bUncC-v1XAVYql85IoyQfx1zJiFyWCZdIC9B22jV1; expires=Tue, 13-Sep-2011 22:03:25 GMT; path=/; domain=.google.ch; HttpOnly"/>
<http:header name="Content-Type" value="text/html; charset=ISO-8859-1"/>
<http:header name="Server" value="gws"/>
<http:header name="Cache-Control" value="private, max-age=0"/>
<http:body media-type="text/html; charset=ISO-8859-1"/>
</http:response>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
<title>Google</title>
<script>window.google={kEI:"rZB-TcL0A4Ov8QOx6YHLCA",kEXPI:"28501,29014,29135,29265,29279",kCSI:{e:"28501,29014,29135,29265,29279",ei:"rZB-TcL0A4Ov8QOx6YHLCA",expi:"28501,29014,29135,29265,29279"},ml:function(){},kHL:"de",time:function(){return(new Date).getTime()},log:function(c,d,
b){var a=new Image,e=google,g=e.lc,f=e.li;a.onerror=(a.onload=(a.onabort=function(){delete g[f]}));g[f]=a;b=b||"/gen_204?atyp=i&ct="+c+"&cad="+d+"&zx="+google.time();a.src=b;e.li=f+1},lc:[],li:0,Toolbelt:{}};
....
....
....
google.timers.load.t)return;google.timers.load.t.ol=(new Date).getTime();google.timers.load.t.iml=f;google.kCSI.imc=d;google.kCSI.imn=b;google.kCSI.imp=e;google.timers.load.t.xjs&&google.report&&google.report(google.timers.load,google.kCSI)}if(window.addEventListener)window.addEventListener("load",l,false);else if(window.attachEvent)window.attachEvent("onload",l);google.timers.load.t.prt=(f=(new Date).getTime());
})();</script>
</center>
</body>
</html>
</pre>
'''Example 3: Example with content type ending with +xml, e.g. image/svg+xml.'''
'''Query:'''<br/><pre class="brush:xquery">http:send-request(<http:request method='get'/>, 'http://upload.wikimedia.org/wikipedia/commons/6/6b/Bitmap_VS_SVG.svg')</pre><br/>
'''Result:'''
<pre class="brush:xquery"><http:response status="200" message="OK">
<http:header name="ETag" value="W/"11b6d-4ba15ed4""/>
<http:header name="Age" value="9260"/>
<http:header name="Date" value="Mon, 14 Mar 2011 19:17:10 GMT"/>
<http:header name="Content-Length" value="72557"/>
<http:header name="Last-Modified" value="Wed, 17 Mar 2010 22:59:32 GMT"/>
<http:header name="Content-Type" value="image/svg+xml"/>
<http:header name="X-Cache-Lookup" value="MISS from knsq22.knams.wikimedia.org:80"/>
<http:header name="Connection" value="keep-alive"/>
<http:header name="Server" value="Sun-Java-System-Web-Server/7.0"/>
<http:header name="X-Cache" value="MISS from knsq22.knams.wikimedia.org"/>
<http:body media-type="image/svg+xml"/>
</http:response>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1063" height="638">
<defs>
<linearGradient id="lg0">
<stop stop-color="#3333ff" offset="0"/>
<stop stop-color="#3f3fff" stop-opacity="0" offset="1"/>
</linearGradient>
<linearGradient id="lg1">
<stop stop-color="#111111" offset="0"/>
<stop stop-color="#111111" stop-opacity="0" offset="1"/>
</linearGradient>
....
....
....
72835 98.448425,358.72835 98.448425,357.52606 98.448425,356.32376 98.448425,355.12147 103.25761,355.12147 108.06679,355.12147 112.87597,355.12147 112.87597,356.32376 112.87598,357.52606 112.87598,358.72836 115.28058,358.72836 117.68516,358.72835 120.08975,358.72835 120.08975,363.53754 120.08975,368.34672 120.08975,373.1559 118.88745,373.1559 117.68516,373.1559 116.48286,373.1559 116.48286,369.54902 116.48286,365.94213 116.48286,362.33524 z M 84.020882,358.72836 84.02088,355.12147 94.841547,355.12147 94.841547,358.72836 84.020882,358.72836 z" fill="#030303"/>
</svg></pre>
[[Category:XQuery]]