开发者

Send HTTP Command using VB.NET

开发者 https://www.devze.com 2022-12-21 04:11 出处:网络
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.

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&parameter=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&parameter=XBMC.updatelibrary%28video%29")
Dim response = client.GetResponse()
0

精彩评论

暂无评论...
验证码 换一张
取 消