LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control website

Solved!
Go to solution

I have a device with static IP connected to my laptop.  From the laptop, I can access the device through internet explorer by typing in the device's static IP in the explore.  When I see the device website, I need to click a few things, enter a string a box, and click save.  

 

Is there a way to automate this in LabVIEW?  Thanks! 

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 6
(3,782 Views)

Yes you can. You can use the HTTP Post and HTTP Get VIs in the Internet toolkit. You will have to look at the source of the webpage to figure out what the POST parameters are if any. If it only uses GET then you can look at the URL as you press buttons to figure out how to build the URL string.

=====================
LabVIEW 2012


Message 2 of 6
(3,780 Views)

I guess I have to get the internet toolkit then.  Does the toolkit comes with the developer suite?  I only have the professional version of labview, do I have to purchase it then?  What kind of licensing is availabe for the toolkit?  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 6
(3,744 Views)
Solution
Accepted by topic author jyang72211

I think the toolkit is a $1,000 addon. But that is a lot of money if all you want to do is a POST or GET. Those are very simple protocols. Some information here and here. This one is a very good tutorial.

 

It is probably worth the money if you need all the other features the internet toolkit offers.

 

Here is an example of how to create your own POST vi. You just build a properly formatted string, send it to the port the http server is listening on, then read the html results until the server closes the connection.

 

address is the server name, e.g., ni.com. It does NOT start with http://

URL is the part after the server name, e.g., /forums in http://ni.com/forums

body is the post parameters. e.g., firstname=steve&lastname=chandler

 

 

 http post.png

=====================
LabVIEW 2012


Message 4 of 6
(3,737 Views)

I noticed an error in my code. The equal comparison for the error code should be a not equal comparison.

 

One more thing that might get you. For a POST the URL should end with a forward slash or you will get an error depending on the server configuration. In the example below that would be /forums/

=====================
LabVIEW 2012


Message 5 of 6
(3,717 Views)

Another option, if you're using Internet Explorer, is to embed it as an ActiveX object.  You can then navigate to the web page, fill values into the form, and submit it.  There are several examples posted on this forum such as:

http://forums.ni.com/t5/LabVIEW/How-to-fill-out-and-submit-a-web-form-using-LabVIEW/m-p/289527

http://forums.ni.com/t5/LabVIEW/Auto-login-to-sites-like-yahoo-gmail-intranet-sites-etc-etc/m-p/2949...

Message 6 of 6
(3,706 Views)