Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 

change http to https (SSL Certificate)

Good afternoon, I am currently developing an application for Roku and it is already working.
I just installed SSL certificates on the server, and is working well.
I Change the URL of my site in the script of the roku application from http to https, but the roku application remains loading.
These are the errors appears:



 pkg:/source/MenuPrincipal.brs(18)
018:    if todobien.error = "si" then
Backtrace:
#0  Function main() As Void
   file/line: pkg:/source/MenuPrincipal.brs(18)
Local Variables:
global           rotINTERFACE:ifGlobal
m                roAssociativeArray refcnt=2 count:0
poster           bsc:roPosterScreen refcnt=1
usuario          roString (2.1 was String) refcnt=1 val:"test1"
pass             roString (2.1 was String) refcnt=1 val:"test2"
todobien         roArray refcnt=1 count:0
sdposter         <uninitialized>
ad               <uninitialized>
mainmenudata     <uninitialized>

BrightScript Debugger>
------ Compiling dev 'myapp' ------

------ Running dev 'myapp' main ------
Url comprueba_usuario = https://mydomine.com/RokuDev/comprueba_user.php?user=tes
t1&pass=test2&idu=6325AF032518&d=Roku%203
BRIGHTSCRIPT: ERROR: ParseJSON: Data is empty: pkg:/source/wallopClient.brs(274)
Url = https://mydomine.com/RokuDev/status_user.php?status=ok&c=Menu%20Principal&
t=Secci%C3%B3n&token=354e78c4bc8xxxxxxxx1
BRIGHTSCRIPT: ERROR: ParseJSON: Data is empty: pkg:/source/wallopClient.brs(133)

BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.


Current Function:
010:
011:    usuario = getStrValFromReg("usuario", "datosApp")
012:    pass = getStrValFromReg("contrasenia", "datosApp")
013:
014:    todobien = comprueba_usuario(usuario, pass)
015:
016:    enviaStatus("ok","Menu Principal","Secci  n")
017:
018:*   if todobien.error = "si" then
019:        showSettingsScreen()
020:    end if
021:
022:     sdposter = "pkg:/images/mm_icon_focus_sd.png"
Syntax Error. (runtime error &h02) in pkg:/source/MenuPrincipal.brs(18)
018:    if todobien.error = "si" then
Backtrace:
#0  Function main() As Void
   file/line: pkg:/source/MenuPrincipal.brs(18)
Local Variables:
global           rotINTERFACE:ifGlobal
m                roAssociativeArray refcnt=2 count:0
poster           bsc:roPosterScreen refcnt=1
usuario          roString (2.1 was String) refcnt=1 val:"test1"
pass             roString (2.1 was String) refcnt=1 val:"test2"
todobien         roArray refcnt=1 count:0
sdposter         <uninitialized>
ad               <uninitialized>
mainmenudata     <uninitialized>

BrightScript Debugger> Syntax Error. (compile error &h02) in $LIVECOMPILE(839)

BrightScript Debugger>
------ Compiling dev 'myapp' ------

------ Running dev 'myapp' main ------
Url comprueba_usuario = https://www.mydomine.com/RokuDev/comprueba_user.php?user
=test1&pass=test2&idu=6325Axxxxxx&d=Roku%203
BRIGHTSCRIPT: ERROR: ParseJSON: Data is empty: pkg:/source/wallopClient.brs(274)
Url = https://www.mydomine.com/RokuDev/status_user.php?status=ok&c=Menu%20Princi
pal&t=Secci%C3%B3n&token=2b9d009a7xxxxxxxxxx70
BRIGHTSCRIPT: ERROR: ParseJSON: Data is empty: pkg:/source/wallopClient.brs(133)

BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.


Current Function:
010:
011:    usuario = getStrValFromReg("usuario", "datosApp")
012:    pass = getStrValFromReg("contrasenia", "datosApp")
013:
014:    todobien = comprueba_usuario(usuario, pass)
015:
016:    enviaStatus("ok","Menu Principal","Secci  n")
017:
018:*   if todobien.error = "si" then
019:        showSettingsScreen()
020:    end if
021:
022:     sdposter = "pkg:/images/mm_icon_focus_sd.png"
Syntax Error. (runtime error &h02) in pkg:/source/MenuPrincipal.brs(18)
018:    if todobien.error = "si" then
Backtrace:
#0  Function main() As Void
   file/line: pkg:/source/MenuPrincipal.brs(18)
Local Variables:
global           rotINTERFACE:ifGlobal
m                roAssociativeArray refcnt=2 count:0
poster           bsc:roPosterScreen refcnt=1
usuario          roString (2.1 was String) refcnt=1 val:"test1"
pass             roString (2.1 was String) refcnt=1 val:"test2"
todobien         roArray refcnt=1 count:0
sdposter         <uninitialized>
ad               <uninitialized>
mainmenudata     <uninitialized>

BrightScript Debugger>
------ Running dev 'myapp' main ------
Url comprueba_usuario = https://www.mydomine.com/RokuDev/comprueba_user.php?user
=test1&pass=test2&idu=6325Axxxxxxx&d=Roku%203
BRIGHTSCRIPT: ERROR: ParseJSON: Data is empty: pkg:/source/wallopClient.brs(274)
Url = https://www.mydomine.com/RokuDev/status_user.php?status=ok&c=Menu%20Princi
pal&t=Secci%C3%B3n&token=2719e49xxxxxxxxxec
BRIGHTSCRIPT: ERROR: ParseJSON: Data is empty: pkg:/source/wallopClient.brs(133)

Current Function:
010:
011:    usuario = getStrValFromReg("usuario", "datosApp")
012:    pass = getStrValFromReg("contrasenia", "datosApp")
013:
014:    todobien = comprueba_usuario(usuario, pass)
015:
016:    enviaStatus("ok","Menu Principal","Secci  n")
017:
018:*   if todobien.error = "si" then
019:        showSettingsScreen()
020:    end if
021:
022:     sdposter = "pkg:/images/mm_icon_focus_sd.png"
Syntax Error. (runtime error &h02) in pkg:/source/MenuPrincipal.brs(18)
018:    if todobien.error = "si" then
Backtrace:
#0  Function main() As Void
   file/line: pkg:/source/MenuPrincipal.brs(18)
Local Variables:
global           rotINTERFACE:ifGlobal
m                roAssociativeArray refcnt=2 count:0
poster           bsc:roPosterScreen refcnt=1
usuario          roString (2.1 was String) refcnt=1 val:"test1"
pass             roString (2.1 was String) refcnt=1 val:"test2"
todobien         roArray refcnt=1 count:0
sdposter         <uninitialized>
ad               <uninitialized>
mainmenudata     <uninitialized>

BrightScript Debugger>


This is the change I made to the script

function getPeliculasEspanol(categoria As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/json.php?cat=" + urlencode(categoria) +"&lang=es&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())   
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Videos
    else
        return []
    end if

End Function

function getPeliculasIngles(categoria As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/json.php?cat=" + urlencode(categoria) +"&lang=en"
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Videos
    else
        return []
    end if

End Function

function api_detalle_pelicula(cve As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/detalle_pelicula.php?cve=" + cve +"&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        'print "titulo: "; json.titulo
        return json
    else
        return []
    end if

End Function

function api_detalle_capitulo(cve As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/detalle_capitulo.php?cve=" + cve+"&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        'print "titulo: "; json.titulo
        return json
    else
        return []
    end if

End Function


function api_movie(cve As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/movie.php?cve=" + cve + "&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        'print "titulo: "; json.titulo
        return json
    else
        return []
    end if

End Function

function enviaStatus(status As String, cve_contenido As String, tipo As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/status_user.php?status=" + urlencode(status) +"&c="+ urlencode(cve_contenido)+"&t="+urlencode(tipo)+"&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        'print "titulo: "; json.titulo
        return json
    else
        return []
    end if

End Function

function api_capitulo(cve As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/capitulo.php?cve=" + cve +"&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        'print "titulo: "; json.titulo
        return json
    else
        return []
    end if

End Function

function log_hls(cve As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/log_hls.php?cve=" + cve +"&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        'print "titulo: "; json.titulo
        return json
    else
        return []
    end if

End Function

function getPeliculasAdultos(categoria As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/adultos.php?cat=" + urlencode(categoria) +"&lang=en&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Videos
    else
        return []
    end if

End Function

function getAdultosLive() As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/adultos_live.php"
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json
    else
        return []
    end if

End Function

function getPPVS() As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/ppvs.php"
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json
    else
        return []
    end if

End Function

function comprueba_usuario(usuario As String, pass As String) As Object
    request = CreateObject("roUrlTransfer")
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    url = UrlServidor()+"/RokuDev/comprueba_user.php?user=" + urlencode(usuario) + "&pass=" + urlencode(pass) + "&idu=" + GetDeviceESN() + "&d="+ urlencode(dispositivo())
    print "Url comprueba_usuario = "; url
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        'print "datos = "; json.mensaje
        return json
    else
        return []
    end if

End Function



function vencimiento(usuario As String) As Object
    request = CreateObject("roUrlTransfer")
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    url = UrlServidor()+"/RokuDev/vencimiento.php?user=" + urlencode(usuario) + "&idu=" + GetDeviceESN() + "&d="+ urlencode(dispositivo())
    print "Url comprueba_usuario = "; url
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        'print "datos = "; json.mensaje
        return json
    else
        return []
    end if

End Function


function activaAdultos(act As String) As Object
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/activar_adultos.php?user=" + urlencode(usuario) + "&a=" + act + "&pass="+ urlencode(pass)
    print "Url comprueba_usuario = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        'print "datos = "; json.mensaje
        return json
    else
        return []
    end if

End Function


Function GetDeviceVersion()
    return CreateObject("roDeviceInfo").GetVersion()
End Function

'******************************************************
'Get our serial number
'******************************************************

Function GetDeviceESN()
    return CreateObject("roDeviceInfo").GetDeviceUniqueId()
End Function


Sub ShowDialog1Button(title As dynamic, text As dynamic, but1 As String)
    'if not isstr(title) title = ""
    'if not isstr(text) text = ""

   ' Dbg("DIALOG1: ", title + " - " + text)

    port = CreateObject("roMessagePort")
    dialog = CreateObject("roMessageDialog")
    dialog.SetMessagePort(port)

    dialog.SetTitle(title)
    dialog.SetText(text)
    dialog.AddButton(0, but1)
    dialog.Show()

    while true
        dlgMsg = wait(0, dialog.GetMessagePort())

        if type(dlgMsg) = "roMessageDialogEvent"
            if dlgMsg.isScreenClosed()
                print "Screen closed"
                return
            else if dlgMsg.isButtonPressed()
                print "Button pressed: "; dlgMsg.GetIndex(); " " dlgMsg.GetData()
                return
            endif
        endif
    end while
End Sub


function BuscarPelicula(query As String) As Object
    request = CreateObject("roUrlTransfer")
    url = "http://mydomine.com/RokuDev/buscar_pelicula.php?q=" + urlencode(query)
    print "Url = "; url
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Videos
    else
        return []
    end if

End Function


function getSeries() As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/series.php"
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Videos
    else
        return []
    end if

End Function

function getSeriesNew(categoria As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/series.php?cat=" + urlencode(categoria) +"&lang=en&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Videos
    else
        return []
    end if

End Function

function getKaraoke(categoria As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/karaokes.php?cat=" + urlencode(categoria) +"&lang=en&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Videos
    else
        return []
    end if

End Function

function getCaricaturas() As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/caricaturas.php?token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Videos
    else
        return []
    end if

End Function


function getDocumentales() As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/documentales.php?token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Videos
    else
        return []
    end if

End Function


function getXXXLiveTV(cve_cat AS String) As Object

    if regread("epg") <> invalid then
        epg_boton = regread("epg")
    else    
        epg_boton = "EPG_Activo"
    endif


    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/xxx_livetv.php?cve="+urlencode(cve_cat)+"&token="+generar_token()+"&epg="+epg_boton
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json
    else
        return []
    end if

End Function

function getLiveTV(cve_cat AS String) As Object

    if regread("epg") <> invalid then
        epg_boton = regread("epg")
    else    
        epg_boton = "EPG_Activo"
    endif


    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/livetv.php?cve="+urlencode(cve_cat)+"&token="+generar_token()+"&epg="+epg_boton
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json
    else
        return []
    end if

End Function

function infoCanalTV(cve_cat As String) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/get_canaltv.php?cve="+cve_cat+"&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json
    else
        return []
    end if

End Function

function getCategoriasLiveTV() As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/cat_livetv.php?token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.LiveTV
    else
        return []
    end if

End Function

function getAdultos() As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/adultos.php?token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())   
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Adultos
    else
        return []
    end if

End Function

function jsonTemporadas(cve_serie As Object) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/temporadas_serie.php?cve="+cve_serie+"&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Temporadas
    else
        return []
    end if

End Function

function jsonPin(pin As Object) As Object
    request = CreateObject("roUrlTransfer")
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")    
    url = UrlServidor()+"/RokuDev/comprueba_pin.php?pin="+pin+"&user="+usuario+"&token="+generar_token()
    print "Url = "; url
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json
    else
        return []
    end if

End Function

function CambiarPinJson(pin As Object, tipo As String) As Object
    request = CreateObject("roUrlTransfer")
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    url = UrlServidor()+"/RokuDev/cambiar_pin.php?pin="+pin+"&user="+usuario+"&idu="+ GetDeviceESN() +"&t="+ tipo +"&token="+generar_token()
    print "Url = "; url
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json
    else
        return []
    end if

End Function


function jsonCapitulos(tempo As String, cve_serie As Object) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/capitulos_temporada.php?cve="+cve_serie+"&temporada="+urlencode(tempo)+"&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Capitulos
    else
        return []
    end if

End Function


function jsonTemas(cve_serie As Object) As Object
    request = CreateObject("roUrlTransfer")
    url = UrlServidor()+"/RokuDev/temas_karaoke.php?cve="+cve_serie+"&token="+generar_token()
    print "Url = "; url
    usuario = getStrValFromReg("usuario", "datosApp")
    pass = getStrValFromReg("contrasenia", "datosApp")
    ba = CreateObject("roByteArray")
    ba.FromAsciiString(usuario+":"+pass)
    request.AddHeader("X-Roku-Reserved-Dev-Id", "125455455f0cb94f9eb9a3a01abfdcd")
    request.AddHeader("X-Content", ba.ToBase64String())    
    request.SetUrl(url)
    html = request.GetToString()
    data = html.Trim()
    json = ParseJSON(data)

    if json <> invalid then
        return json.Capitulos
    else
        return []
    end if

End Function



Function urlencode(text as string) as string
xfer=createobject("roUrlTransfer")
return xfer.urlencode(text)
End Function

' Tells Wallop to tune to a specified channel number.
' This function will block until Wallop reports that
' the channel is ready.
'
' #TODO handle wallop timing out and getting stuck in
' this while loop.
function tuneChannel(channelNum As string)
    request = CreateObject("roUrlTransfer")
    url = getBaseWallopUrl() + "/channels/" + channelNum + "/tune"
    request.SetUrl(url)
    request.PostFromString("")
    sleep(500)

    waiting = true
    while waiting
        print "Waiting on channel to be ready"
        request = CreateObject("roUrlTransfer")
        url = getBaseWallopUrl() + "/channels/" + channelNum + "/status"
        request.SetUrl(url)
        response = request.GetToString()
        data = response.Trim()
        json = ParseJSON(data)
        if json = invalid OR json.ready <> true then
            ' Wait and ask again
            sleep(500)
        else
            ' Done waiting, exit the while loop.
            waiting = false
        end if
    end while
    print "DONE tuning channel"

End Function


' Tells Wallop to stop the specified channel number.
function stopChannel(channelNum As string)
    request = CreateObject("roUrlTransfer")
    url = getBaseWallopUrl() + "/channels/" + channelNum + "/stop"
    request.SetUrl(url)
    request.PostFromString("")
End Function

function UrlServidor() As string
    url = "https://mydomine.com"
    return url
End Function

function UrlLogin() As string
    url = UrlServidor()+"/comprueba_user.php"
    return url
End Function

function ServidorPosters() As string
    url = "https://mydomine.com/posters/"
    return url
End Function

Function generar_token() As String
    hexChars = "0321456789abcde"
    hexString = ""
    For i = 1 to 25
        hexString = hexString + hexChars.Mid(Rnd(16) - 1, 1)
    Next
    Return hexString
End Function


what I missing add to do it works?
Thanks in advance.
0 Kudos
6 Replies
belltown
Level 7

Re: change http to https (SSL Certificate)

request.SetCertificatesFile ("common:/certs/ca-bundle.crt")
https://github.com/belltown/
0 Kudos

Re: change http to https (SSL Certificate)

Thanks for you help.
but where I need to write this line?
 i make a mistake.

....
function UrlServidor() As string
   request.SetCertificatesFile ("common:/root/www_mysite_com.csr")
    url = "https://mydomine.com"
    return url
End Function
....

this is the error
------ Running dev 'myapp' main ------

BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.


Current Function:
816:  function UrlServidor() As string
817:*   request.SetCertificatesFile ("common:/root/www_mysite_com.csr")
818:      url = "https://www.mysite.com"
819:      return url
820:  End Function
'Dot' Operator attempted with invalid BrightScript Component or interface refere
nce. (runtime error &hec) in pkg:/source/wallopClient.brs(817)
817:    request.SetCertificatesFile ("common:/root/www_mysite_com.csr")
Backtrace:
#2  Function urlservidor() As String
   file/line: pkg:/source/wallopClient.brs(817)
#1  Function comprueba_usuario(usuario As String, pass As String) As Object
   file/line: pkg:/source/wallopClient.brs(265)
#0  Function main() As Void
   file/line: pkg:/source/MenuPrincipal.brs(14)
Local Variables:
global           rotINTERFACE:ifGlobal
m                roAssociativeArray refcnt=4 count:0
request          <uninitialized>
url              <uninitialized>

BrightScript Debugger>


Thanks
0 Kudos
belltown
Level 7

Re: change http to https (SSL Certificate)

Put it after this line:

request = CreateObject("roUrlTransfer")
https://github.com/belltown/
0 Kudos

Re: change http to https (SSL Certificate)

Thanks, I have a little confusion, but I understood.
is working...
0 Kudos

Re: change http to https (SSL Certificate)

thanks
0 Kudos

Re: change http to https (SSL Certificate)

"belltown" wrote:
Put it after this line:

request = CreateObject("roUrlTransfer")


Thank you
0 Kudos