Examples

Assume the following response is received:
Code
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:
Code
Call:
  echo -a $urlget(id).ReplyLine

Result:
  HTTP/1.1 200 OK


Get version text:
Code
Call:
  echo -a $urlget(id).VersionText

Result:
  HTTP/1.1


Get numerical version :
Code
Call:
  echo -a $urlget(id).Version

Result:
  1.1


Get status code:
Code
Call:
  echo -a $urlget(id).StatusCode

Result:
  200


Get status text:
Code
Call:
  echo -a $urlget(id).StatusText

Result:
  OK


Get All Headers
Code
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:
Code
Call:
  echo -ag $urlget(id, &bvar).Headers

Result (number of bytes wrote to the bvar):
  305


Gets the total number of headers received
Code
Call:
  echo -ag $urlget(id, 0).Headers

Result:
  8


Gets the 1st and 3rd header received:
Code
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:
Code
Call:
  echo -ag $urlget(id, 5, &bvar).Headers

Result (number of bytes wrote to the bvar):
  17


Gets the Number of 'Set-Cookie' headers:
Code
Call:
  echo -ag $urlget(id, set-cookie, 0).Headers

Result:
  2


Gets the 1st Set-Cookie header
Code
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
Code
Call:
  echo -ag $urlget(id, set-cookie, 2, &bvar).Headers

Result (number of bytes wrote to the bvar):
  79


Last edited by FroggieDaFrog; 22/10/20 09:52 PM.

I am SReject
My Stuff