Hello All, I am anewbie, in a process of making my first roku app which fetches data from another website after Logging in. I have attached all the necessary headers and using AsyncPostFromSTring to post the data. I am getting a msg.GetResponseHeadersr but with msg.GetString() it only revelas two character "< []" (small box).
I don't know what I am doing wrong. GetResponseHeader says "transfer-encoding: chunked" , is this where the issue is ?
this is my code
loginURL="http://www.example.com/members/logmein.php"
username="uname"
password="pword"
postContent="username="+username+"&password="+password
request = CreateObject("roURLTransfer")
xport=CreateObject("RoMessagePort")
request.InitClientCertificates()
request.SetCertificatesFile("common:/certs/ca-bundle.crt")
request.setUrl(loginURL)
request.SetMessagePort(xport)
request.RetainBodyOnError(true)
REM **** THIS headers works fine in PHP Curl ****
request.AddHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
request.AddHeader("Accept-Encoding","gzip, deflate")
request.AddHeader("Accept-Language","en-US,en;q=0.8,hi;q=0.6,ne;q=0.4")
request.AddHeader("Cache-Control","max-age=0")
request.AddHeader("Connection","keep-alive")
request.AddHeader("Content-Type","application/x-www-form-urlencoded")
request.AddHeader("Host","www.example.com")
request.AddHeader("Origin","http://www.example.com")
request.AddHeader("Referer","http://www.example.com/logmein.php")
request.AddHeader("User-Agent","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36")
request.EnableCookies()
if (request.asyncPostFromSTring(postContent))
msg = wait(0,xport)
if type(msg) = "roUrlEvent"
Print "we are getting some input"
Print msg.GetResponseHeaders() ' This prints header
print msg.GetString() ' this doesn't work
end if
end if
Any help is appreciated. Thank you