I'm trying to send an HTTP command using VB.NET and I'm not quite sure how to do it. I don't want to actually navigate to the page, just execute the command.
http://xbmc.local/xbmcCmds/xbmcHttp?comman开发者_开发问答d=ExecBuiltIn¶meter=XBMC.updatelibrary%28video%29
What I'm doing is building an integrated interface for my XBMC home theater, and my home automation.
You can use the WebRequest object to send an HTTP Request.
' 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()
The WebResponse class has a number of properties you can check to see if the request succeeded or not. And just something to be aware of, GetResponse()
will throw an exception if it times out.
Try the following
Dim client = WebRequest.Create("http://xbmc.local/xbmcCmds/xbmcHttp?command=ExecBuiltIn¶meter=XBMC.updatelibrary%28video%29")
Dim response = client.GetResponse()
精彩评论