ExamplesAssume the following response is received:
HTTP/1.1 200 OK
Server: site.com
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Connection: keep-alive
Set-Cookie: sessid=123; Domain=site.com; Path=/; Secure; HttpOnly
Set-Cookie: uid=abc; Domain=site.com; Path=/; secure; HttpOnly; Max-Age=2592000
Get status line:
Call:
echo -a $urlget(id).ReplyLine
Result:
HTTP/1.1 200 OK
Get version text:
Call:
echo -a $urlget(id).VersionText
Result:
HTTP/1.1
Get numerical version :
Call:
echo -a $urlget(id).Version
Result:
1.1
Get status code:
Call:
echo -a $urlget(id).StatusCode
Result:
200
Get status text:
Call:
echo -a $urlget(id).StatusText
Result:
OK
Get All Headers
Call:
echo -a $urlget(id).Headers
Result (line breaks processed for readability):
Server: site.com
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Connection: keep-alive
Set-Cookie: sessid=123; Domain=site.com; Path=/; Secure; HttpOnly
Set-Cookie: uid=abc; Domain=site.com; Path=/; secure; HttpOnly; Max-Age=2592000
Store all headers in a bvar:
Call:
echo -ag $urlget(id, &bvar).Headers
Result (number of bytes wrote to the bvar):
305
Gets the total number of headers received
Call:
echo -ag $urlget(id, 0).Headers
Result:
8
Gets the 1st and 3rd header received:
Call:
echo -ag $urlget(id, 1).Headers
echo -ag $urlget(id, 3).Headers
Result:
Server: site.com
Content-Encoding: gzip
Stores the 5th header in a bvar:
Call:
echo -ag $urlget(id, 5, &bvar).Headers
Result (number of bytes wrote to the bvar):
17
Gets the Number of 'Set-Cookie' headers:
Call:
echo -ag $urlget(id, set-cookie, 0).Headers
Result:
2
Gets the 1st Set-Cookie header
Call:
echo -ag $urlget(id, set-cookie, 1).Headers
Result:
Set-Cookie: sessid=123; Domain=site.com; Path=/; Secure; HttpOnly
Stores the 2nd Set-Cookie header in a bvar
Call:
echo -ag $urlget(id, set-cookie, 2, &bvar).Headers
Result (number of bytes wrote to the bvar):
79