lbell
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2014
10:50 AM
addheader? rourltransfer
Can somebody explain to me what the addheader() does and how to use it?
2 REPLIES 2

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2014
03:48 PM
Re: addheader? rourltransfer
Addheader lets you add a header key/value pair to the data send with an HTTP request. Here's an example:
So:
So:
function GetData() as object
xfer=createobject("roURLtransfer")
xfer.SetUrl("https://api.myserver.com/data")
xfer.SetCertificatesFile("common:/certs/ca-bundle.crt")
xfer.InitClientCertificates()
ba = CreateObject("roByteArray")
ba.FromAsciiString("me@myemailaddress.com":"myAPIKeyblahblah")
xfer.AddHeader("Authorization", "Basic " + ba.ToBase64String())
xfer.AddHeader("X-API-VERSION","3")
results=xfer.GetToString()
'print results
data=parsejson(results)
return data
end function
lbell
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2014
12:58 PM
Re: addheader? rourltransfer
Ahhh, makes sense. Thanks(: