Send HTTP command using VB.NET

I am trying to send an HTTP command using VB.NET and I am not quite sure how to do this. I do not want to actually go to the page, just run the command.

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

I am developing an integrated interface for the XBMC home theater and my home automation.

+4
source share
2 answers

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 that you can check to ensure that the request was successful or not. And just something to be aware of, GetResponse() will throw an exception if it expires.

+2
source

Try to execute

 Dim client = WebRequest.Create("http://xbmc.local/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.updatelibrary%28video%29") Dim response = client.GetResponse() 
+1
source

Source: https://habr.com/ru/post/1301869/


All Articles