LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

web page data

I've got a program that I'm working on, but it isnt working quite right.

I'm trying to open up this weather page:

http://weather.noaa.gov/weather/current/KJXN.html 

then get certain pieces of information, and save them to a spreadsheet file programmatically.

 

I can handle all of that, except I'm having a little trouble parsing out the information I want.

I'm using the three attached VI's (1 top level, 2 subVI's. The "Read Temp WS....." is the top level) that I found somewhere on the forums.... can't quite remember where. I modified them a bit too.

 

If you run the top level VI as-is, you will see a text indicator on the front panel that shows the source code for the website I posted above.

I know that all the information I need is in this format:

 

<TD><FONT FACE="Arial,Helvetica">  * </FONT></TD>

 

Where the * represents the data that I want.

So basically, I tried use a Match Expression function in a loop to find each instance of the above expression.

It isnt working quite as I had hoped.
Can anyone see what I am doing wrong?
Thank you.

Cory K
0 Kudos
Message 1 of 7
(3,092 Views)
After a quick glance I am a bit perplexed about the use of Insert Into Array in Read Temp WS.... VI.  It seems you should use Build Array with concatenate inputs selected.
0 Kudos
Message 2 of 7
(3,081 Views)

I changed the Insert Into Array to Build Array... I guess I was just in a Rube Goldberg mood.

The string is still being parsed incorrectly though.

Message Edited by Cory K on 01-07-2010 03:01 PM
Cory K
0 Kudos
Message 3 of 7
(3,069 Views)

I just realized something. It isnt the top-level VI causing the issue.

The subVI is not reading the source code in correctly.

If you open the URL in a web browser, then select 'View Source' and compare that to what the front panel shows, you will notice some subtle differences.

I will take a look at that and see what is going on.

Cory K
0 Kudos
Message 4 of 7
(3,060 Views)

I figured out what the problem was.

Just in case anyone ever runs into a similar problem, I will post the VI.

Cory K
0 Kudos
Message 5 of 7
(3,037 Views)

Well, I thought I solved this issue, but I guess not entirely.

My approach was the following:
1) read the source code of the web page.

2) search through the source code (converted to string) for a certain string pattern

3) build an array of all the matches

4) index out the fields I need

 

Here's the issue:

If you run the program one day, it will run fine. But if you run it a different day, it may or may not work.

The reason is because the source code is shifted around, and things are sometimes at different indexes.

 

Does anyone recommend a better approach than what I described above?

Cory K
0 Kudos
Message 6 of 7
(2,985 Views)

How about if you look for something more spacific? See attached.

 

 

I tried it a few times and it give me the answer that I am expecting.

Tim
GHSP
Message 7 of 7
(2,970 Views)