Hi,
I'm new to BrightScript but trying to put together a proof of concept for Roku as a streaming client for IP VOD from my employer, a paytv broadcaster. I'm trying to grab a session id from a cookie on our website so I can pass it back as part of a JSON login data structure but I'm really struggling to get more than the header and body back from the server. This is my best attempt so far: I can only make the GetCookies call at the expense of not getting the header and body, and I still don't get any cookies :(. Any help appreciated ....
url = "http://www.geekzone.co.nz"
request = CreateObject("roUrlTransfer")
request.SetUrl( url )
request.EnableCookies()
request.EnableFreshConnection(true)
xport=CreateObject("RoMessagePort")
request.setport(xport)
if (request.asyncPostFromSTring("t"))
'"request.async is true"
msg = wait(0,xport)
'"we should have a message"
if type(msg) = "roUrlEvent"
'"ok we have a url event"
hedone={}
hedtwo={}
hedone=msg.GetResponseHeadersArray()
hedtwo=msg.GetResponseHeaders()
body=msg.GetString()
code=msg.GetResponseCode()
event={result:hedone, headers:hedtwo, body:body, code:code}
end if
end if
'html = request.GetToString()
'print html
'print "len body = ", len(body)
print "getting geekzone cookies"
cookies = request.GetCookies( ".geekzone.co.nz", "/" )
print "printing geekzone cookies"
for each cookie in cookies
print cookie
end for