LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using labview to read html code of websites

How can you get Labview to read the html code of particular websites? I basically wnat to beable to scan through the html code looking for links. So that I can check my site for broken links etc... I know that there are other programs to do this, I just thought it would be a good exercise for me. Thanks in advance!
Greg
0 Kudos
Message 1 of 4
(5,454 Views)
Greg,

I have a bit of experience working with LabVIEW and HTML.

First of all, you need to know what HTML is. Text. At least, that's how ANYTHING but a browser sees it, including LabVIEW.

So, in order to solve your problem, try this. Send the HTML Code through a simple text search algorithm. Look for all instances of a link ("Href..."). To test to see if your link is broken, use the Internet Toolkit and request a header from the link's site. If you get a header, the link is good (unless there is no valid content....)

You have the distinct advantage (which I didn't have) of being the creator of the HTML. Therefore, you can know exactly where the links are.

In case you are having difficulty with the concept still, try this. Go to any web page,
and view the source (U in Netscape). You will see the text that is the HTML code, which your browser interprets to display the page and links. Trust me, they are quite different in appearance.

Internet programming in LabVIEW is quite easy. I wrote a program a couple of years ago that took an address, went to a couple of sites, and formatted an email and sent it to Congressional Representatives based on the zip code. It took me 45 minutes to do this, something which would have taken two or more days in C (Text searching, text formatting, reading HTML from online source, formatting email, and sending email.)

I really love to use LabVIEW for internet programming, especially CGI, but unfortunately, I cannot easily implement it. Seems my host wanted to charge quite a sum of money to install the rutime engine on their server (hello, NI engineers...do you hear me...I need a compressed version for internet programming....)

Good luck, and let us know how you do.

If you em
ail me, I may send you a couple of the functions from the sample above. I won't send the whole thing, as I am quite proud of what it does and how it does it, but I will certainly send enough to give you a direction to go.
0 Kudos
Message 2 of 4
(5,454 Views)
I'm guessing you're familiar with HTML and are asking more about the process of programmatically obtaining the source for a given URL.

The short, easy way: get the Internet Toolkit (Connectivity Toolset) and use the Get HTTP Document VI to return HTML source, parse for links, repeat.

The trickier, low-level way: open a TCP/IP connection to the server (e.g. host: www.ni.com, port:80), TCP Write "GET /\n" (backslash codes) and TCP Read back the response from the server to get the source code for the site homepage. Parse for links, repeat.

Regards,
John Lum
National Instruments
0 Kudos
Message 3 of 4
(5,454 Views)
The most simple is to use "DataSocket Read" function.
Wire the URL of the page and it returns the page content.
Use To G Data to convert the variant ouput to a string.

Jean-Pierre Drolet


LabVIEW, C'est LabVIEW

Message 4 of 4
(5,454 Views)