Forum Discussion

mitchstein's avatar
mitchstein
Roku Guru
10 years ago

Simple http missing something...

request.SetMessagePort(port)
request.SetUrl("http://www.tvbydemand.com/video_update_views.asp?vpath=" & episode.url) (the error appears to be at the &)

what I'm trying to do is add code tothe sample player that will simply call up video_update_views.asp and pass the url of the video being played as "vpath"

there will be no return information back to the roku, just want to be able to update my videos in my database on my website.. figured this should be easy, but I'm missing something very simple.. (probably cause I've been working on this all night (31 hours straight without sleep)..

5 Replies

  • Get some sleep! lol

    Try setting up your url before passing it to the .SetUrl and use a "+" instead of a "&"


    url = http://www.tvbydemand.com/video_update_views.asp?vpath=" + episode.url
    request.SetUrl(url)


    You may also need to encode your episode.url depending on the characters contained within.
  • "mitchstein" wrote:
    request.SetMessagePort(port)
    request.SetUrl("http://www.tvbydemand.com/video_update_views.asp?vpath=" & episode.url) (the error appears to be at the &)

    what I'm trying to do is add code tothe sample player that will simply call up video_update_views.asp and pass the url of the video being played as "vpath"

    there will be no return information back to the roku, just want to be able to update my videos in my database on my website.. figured this should be easy, but I'm missing something very simple.. (probably cause I've been working on this all night (31 hours straight without sleep)..

    This might work ('+' is the BrightScript string concatenation operator):
    request.SetUrl("http://www.tvbydemand.com/video_update_views.asp?vpath=" + episode.url)

    Although you might need to url-escape the query string, in which case try:
    request.SetUrl("http://www.tvbydemand.com/video_update_views.asp?vpath=" + request.Escape(episode.url))


    EDIT: Looks like Rob beat me to it.
  • yep that should be it!! I was coding all day in asp using thisstring & thatstring... forgot in brightscript uses + instead of &.. duh.. and the escape is probably neccessary will let you know how I made out as soon as I get a chance to try it.. tonite though, sleep, just spent another 10 hours working on new asp code, lol.. thanx for the quick response though..
  • do I need to anything else in brisghtscript to execute the url, I do not need any displays (do not want it to display anything) just want to the vpath value to the asp page... like does it need a close statement or execute statement?
  • If you don't care about headers and response codes, then just call request.GetToString() after the call to SetUrl().