我正在尝试使用 VB.NET 发送 HTTP 命令,但我不太确定该怎么做。我不想实际导航到页面,只需执行命令。

http://xbmc.local/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary%28video%29

我正在做的是为我的 XBMC 家庭影院和我的家庭自动化构建一个集成界面。

最佳答案

您可以使用 WebRequest 对象发送 HTTP 请求。

' Create a WebRequest object with the specified url. '
Dim myWebRequest As WebRequest = WebRequest.Create(url)

' Send the WebRequest and wait for response. '
Dim myWebResponse As WebResponse = myWebRequest.GetResponse()

WebResponse 类有许多属性,您可以检查请求是否成功。需要注意的是,GetResponse() 会在超时时抛出异常。

10-07 19:39
查看更多