LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

retrive html link data

Hi,
I am after a bit of info as to how to talk to the following type of URL data using labview.
the site is set up so that every time i write a value in the following format it stores the last value into the data base:
 
 
where i can enter the data by changing the value 1234 to any value i wish to use.
 
i then need a bit of code to retrieve the data which can be found when I use
 
I have used datasocket and that doesnt seem to like it and i also have the Internet toolkit for labview. any ideas would be much appreciated.
thanks
 
0 Kudos
Message 1 of 8
(3,717 Views)
Unfortunately, I don't have the Internet Toolkit, so I can't comment on that. What platform are you running on? If you're on Windows, you may want to try something simple like the example given here. Your second URL generated an error page with an "Object not found!" message so I really couldn't test the operation of the example against that URL.
Message 2 of 8
(3,709 Views)
Hi,
  which version of LabVIEW are you running, and do you have the correct second link for the retrieval?
The link smercurio_fc indicated is a very neat solution, and if the return of infomation is simple enough, then it should be easy to parse the returned html using the usual string manipulation vi's.
 
Thanks
Sacha Emery
National Instruments (UK)
// it takes almost no time to rate an answer Smiley Wink
Message 3 of 8
(3,692 Views)

I am still struggling to get hold of the actual value. using active x it seems to have too long a delay between writing the values and then recieving it. below is the header info which I am parsing but still dont seem to have it working correctly, any ideas using sockets?

Sending request:

GET /disco/?cmd=property+/uk/co/develop-ing+buff1 HTTP/1.1
Host: www.meshmedia.org
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Connection: close

This is the HTTP request. You'll open the socket and write these lines to it, terminating each one with a carriage return and line feed. To terminate the request you add another CRLF after the last line. so shown with the CRLFs:
 
GET /disco/?cmd=property+/uk/co/develop-ing+buff1 HTTP/1.1(CR)(LF)
Host: www.meshmedia.org(CR)(LF)
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)(CR)(LF)
Connection: close(CR)(LF)
(CR)(LF)
 
Then you wait for a response from the socket.

Receiving Header:

HTTP/1.1·200·OK
(CR)(LF)
Date:·Wed,·25·Oct·2006·09:51:18·GMT(CR)(LF)
Cache-Control:·no-store,·no-cache,·must-revalidate,·post-check=0,·pre-check=0(CR)(LF)
Pragma:·no-cache(CR)(LF)
Content-Length:·8(CR)(LF)
Content-Type:·text/plain;·charset=UTF-8(CR)(LF)
x-mm-session:·f5318b9effa6691273e65bac93b8b78(CR)(LF)
Connection:·close(CR)(LF)
(CR)(LF)

Content (Length = 8):

1234(CR)(LF)
(CR)(LF)
This is the response.  You read the header lines until you get a blank line (one CRLF after another), then you know that the next one is the content line you are interested in.  Then read the final blank line to complete transfer and close the socket.
0 Kudos
Message 4 of 8
(3,668 Views)
It's not clear to me what your issue is. With the example VI that I gave you can easily accomplish what you're trying to do without having to resort to sockets. I suppose if you wanted to learn about networking you could go that route, but in my book I'd look for a quick and easy solution. Using the above VI, if you enter "http://www.meshmedia.org/disco/?cmd=property+/uk/co/develop-ing+buff1" in the URL control the "innerHTML" property, which gets displayed on the front panel "HTML Source Code" indicator is :

<PRE>1234

</PRE>

That, to me, seems far easier to parse than what you're trying to do with sockets.
0 Kudos
Message 5 of 8
(3,657 Views)
Thanks a lot again for your exceptionally quick response. The solution you gave before was working perfectly, the only problem is that the actual reading of the address was not very responsive. the write would work first time, but the read would take several refreshes before the value would actually update. I need to poll the value on the website untill I get a data change, which should happen once every second. (the speed it is being written to) The network guy that has given me the address has said that active X will not respond quick enough and has given me some code to use with sockets to pull back the data. I am familiar with labVIEW datasocket but cannot get that to work and am not sure if it is the ideal solution. any ideas would be much appreciated. will be online all day.
0 Kudos
Message 6 of 8
(3,653 Views)
Hi

Maybe I'm missing something, but if you have the internet toolkit why don't you just use the "URL Get HTTP Document" VI?
See attached screenshot.
To write a value, just concatenate "+1234" or whatever your number is to the given string.
The value you're looking for is in the "content" string.

Hope this helps
Daniel

Message 7 of 8
(3,645 Views)
that is exactly what i am looking for. much appreciated. i knew it would be pretty simple with the toolkit, but was trying to pull back the document insead. thanks again.
0 Kudos
Message 8 of 8
(3,637 Views)