send token on http post <solved> Thanks Chris!

i have tried everything to do this but im not having any luck here!!

what have I done wrong in this code below? it wont even load the app in my box when adding this and i cant figure out what i have done wrong, i have used the regScreen as a template to do this


'***************************************************************
' Check user is paid or not and update registry
'***************************************************************

Function checkUserType(token As String) As String
    
    token =  RegRead("RegToken", "Authentication")
   
    m.UrlBase         = "http://XXXXXX.net/roku"
    m.UrlGetUserInfo  = m.UrlBase + "/accounts.php"

    http = NewHttp(m.UrlGetUserInfo)
    http.AddParam(" token", token)

while true
        rsp = http.Http.GetToString()
        xml = CreateObject("roXMLElement")
        if not xml.Parse(rsp) then
            print "Can't parse check User status"
            ShowConnectionFailed()
            return 2
        endif

if xml.GetName() <> "result" then
            print "unexpected check user status response: ", xml.GetName()
            ShowConnectionFailed()
            return 2
        endif

        if islist(xml.GetBody()) = true then
            for each e in xml.GetBody()
                if e.GetName() = "type" then
                    userType = e.GetBody()
                    RegWrite( "userType", userType)
                    else
                        return 3
                    endif            
              next
        endif
end while

End Function

also is it possible to add this to the appDetailsScreen , or maybe appHomeScreen so that it checks on another page outside the regScreen?

Returning an integer from a function whose return type is a string is one problem I see right off. What kind of output are you seeing on the debug console?

Chris your gonna love this response!!!

What do you mean debug console??

i am using notepad and my roku as testing nothing else!

From section 8 of RokuDvp-DeveloperGuide.pdf

“RokuDvp-DeveloperGuide.pdf” wrote:
Using a standard shell program and a telnet client application, you can connect to the console for your application. The console provides you a window into the runtime environment for your application.

To access the debug console telnet to port 8085 on your box.

all i can say is WOW!!!

weeks of posting on here and didnt know this!! Chris you have been very helpful!!

Using the debug console and the Print statement is your friend when debugging for sure! The Stack Trace is also very helpful when you throw errors.

Question for ROKU. Does the Print statement affect performance? Should Print statements be commented out for a production build/release?

THX

“FML2010” wrote:
all i can say is WOW!!!

weeks of posting on here and didnt know this!! Chris you have been very helpful!!
If you haven’t already, you should probably read through the RokuDvp-DeveloperGuide.pdf that’s included with the SDK. Section 8.0 covers debugging…

Reading ALL those docs are a huge task!!

Everyone refers to them but sometimes they arent easy to understand and its easy to miss something or pass right over it.

so far the telnet has helped me a ton!! i have a laptop and a desktop on my desk so i can debug on one while working on the other and watching on the Tv

Yes. print statements can affect performance.

It’s usually not noticeable for error conditions you’d like to keep track of when debugging your app, so no need to comment those out.

But if you are printing out every URL in your content list, those hundreds or thousands of print statements may very well lead to a slowdown that your users notice.

–Kevin