• <bdo id='Gp5sU'></bdo><ul id='Gp5sU'></ul>

      1. <legend id='Gp5sU'><style id='Gp5sU'><dir id='Gp5sU'><q id='Gp5sU'></q></dir></style></legend>

        <small id='Gp5sU'></small><noframes id='Gp5sU'>

        <tfoot id='Gp5sU'></tfoot>
        <i id='Gp5sU'><tr id='Gp5sU'><dt id='Gp5sU'><q id='Gp5sU'><span id='Gp5sU'><b id='Gp5sU'><form id='Gp5sU'><ins id='Gp5sU'></ins><ul id='Gp5sU'></ul><sub id='Gp5sU'></sub></form><legend id='Gp5sU'></legend><bdo id='Gp5sU'><pre id='Gp5sU'><center id='Gp5sU'></center></pre></bdo></b><th id='Gp5sU'></th></span></q></dt></tr></i><div id='Gp5sU'><tfoot id='Gp5sU'></tfoot><dl id='Gp5sU'><fieldset id='Gp5sU'></fieldset></dl></div>
      2. 如何向 roku 中的某些服务器发出 api 请求

        时间:2023-05-15
          <bdo id='vGqe9'></bdo><ul id='vGqe9'></ul>

          1. <small id='vGqe9'></small><noframes id='vGqe9'>

          2. <tfoot id='vGqe9'></tfoot>
                <tbody id='vGqe9'></tbody>
                  <legend id='vGqe9'><style id='vGqe9'><dir id='vGqe9'><q id='vGqe9'></q></dir></style></legend>
                  <i id='vGqe9'><tr id='vGqe9'><dt id='vGqe9'><q id='vGqe9'><span id='vGqe9'><b id='vGqe9'><form id='vGqe9'><ins id='vGqe9'></ins><ul id='vGqe9'></ul><sub id='vGqe9'></sub></form><legend id='vGqe9'></legend><bdo id='vGqe9'><pre id='vGqe9'><center id='vGqe9'></center></pre></bdo></b><th id='vGqe9'></th></span></q></dt></tr></i><div id='vGqe9'><tfoot id='vGqe9'></tfoot><dl id='vGqe9'><fieldset id='vGqe9'></fieldset></dl></div>

                  本文介绍了如何向 roku 中的某些服务器发出 api 请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我在使用 roku 和 roku 特定语言 (BasicScript) 方面非常陌生.我需要对某些服务器进行 api 调用以获取频道.我不明白如何在 roku 中做到这一点.请提出建议.

                  I am very much new in working with roku and roku specific language( BasicScript ). I need to make api calls to some server to get the channels. I am not understanding how to do it in roku. Please suggest.

                  推荐答案

                  这是直接的方法,无需依赖 SDK 中包含的代码库的语法:

                  here is the direct way to do it without having to rely on the syntax of the code libraries that are included in your SDK:

                  阻塞方法(所有程序执行停止,直到检索到 URL):

                  Blocking Method (all program execution stops until the URL is retrieved):

                  url="http://myserver.com/anExampleQuery?getmydata&apikey=AX5GZP5LL45D987D0&format=XML"
                  xfer=createobject("roURLTransfer")
                  xfer.seturl(url)
                  data=xfer.gettostring()
                  

                  非阻塞方法,你可以在等待数据的同时做其他事情:

                  Non Blocking Method where you can do other things while waiting for data:

                  url="http://myserver.com/anExampleQuery?getmydata&apikey=AX5GZP5LL45D987D0&format=XML"
                  xfer=createobject("roURLTransfer")
                  xfer.seturl(url)
                  port=createobject("roMessagePort")
                  xfer.setport(port)
                  timer=createobject("roTimeSpan")
                  timer.mark()
                  xfer.asyncgettostring()
                  while true    
                      msg=wait(100,port) '100 millisecond pause
                      if type(msg)="roUrlEvent" then
                  
                          if msg.getresponsecode()=200 then
                              data=msg.getstring()
                              headers=msg.getresponseheadersarray()
                              exit while
                          else
                              xfer.asynccancel()
                          end if
                      else
                          print "do something useful while we wait for data"   
                      end if
                      if timer.totalmilliseconds() > 500 then
                          ?"timeout exceeded"
                          exit while
                      end if
                  end while
                  print "***************HEADERS******************"
                  for each header in headers
                  print header
                  end for
                  print "***************DATA*********************"
                  print data
                  print "****************************************"
                  

                  这篇关于如何向 roku 中的某些服务器发出 api 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Google Maps/Places 'autocomplete' API 可以通过 AJAX 使用吗? 下一篇:使用 XMLHttpRequest 上传大文件时的进度条

                  相关文章

                  <legend id='amZqq'><style id='amZqq'><dir id='amZqq'><q id='amZqq'></q></dir></style></legend>

                    <small id='amZqq'></small><noframes id='amZqq'>

                  1. <i id='amZqq'><tr id='amZqq'><dt id='amZqq'><q id='amZqq'><span id='amZqq'><b id='amZqq'><form id='amZqq'><ins id='amZqq'></ins><ul id='amZqq'></ul><sub id='amZqq'></sub></form><legend id='amZqq'></legend><bdo id='amZqq'><pre id='amZqq'><center id='amZqq'></center></pre></bdo></b><th id='amZqq'></th></span></q></dt></tr></i><div id='amZqq'><tfoot id='amZqq'></tfoot><dl id='amZqq'><fieldset id='amZqq'></fieldset></dl></div>
                      <bdo id='amZqq'></bdo><ul id='amZqq'></ul>

                  2. <tfoot id='amZqq'></tfoot>