mmcbride
15 years agoNewbie
necessary data rewind wasn't possible
I cannot seem to figure out this problem. I am using AsyncPostFromString to login to a form that only allows posting via username and password. From the traces it appears to work, but I really need the HTML that is returned after a login. GetString always returns the rewind isn't possible error, which I have read on the boards is due to cookies. Since I have the headers for the login I go ahead and construct another http request and just use getString but it always hangs at that point. I'm stumped. If I could get the tcpdump on the roku to collect the full packets it would help, and it would help even more if I understood what the rewind isn't possible message really meant. This code could be totally wrong as I'm still trying to learn. Any help is appreciated.
http = CreateObject("roUrlTransfer")
port = CreateObject("roMessagePort")
headers = CreateObject("roAssociativeArray")
http.SetPort(port)
http.SetUrl("http://myurl/login")
resp = http.AsyncPostFromString("name=user&password=pass") 'Seems to work but full tcp would help
message = wait(0,http.GetPort())
headers=message.GetResponseHeaders()
for each mes in headers
print mes
next
httptwo = CreateObject("roUrlTransfer")
porttwo = CreateObject("roMessagePort")
httptwo.SetHeaders(headers)
httptwo.SetPort(porttwo)
httptwo.SetUrl("http://myurl/data")
resp=httptwo.GetToString()
messagetwo = wait(0,httptwo.GetPort()) 'Hangs here
print resp
