Help with pulling data from web page


#1

1) Give a description of the problem
I am brand new to webcore and have been trying for a few days to figure out how to pull data from a website. Particularly I want to get the current water level for Table Rock Lake from http://tablerock.uslakes.info/Level/

I am using a get to http://tablerock.uslakes.info/Level/ to pull info and logging json (I think) however it does not give data like any examples I have found nor does it look like json data and I am unable to figure out how to pull the water level from it.

I’m really just looking for somebody to take pity on me and tell me step by step how to set webcore to get the information I’m looking for please.


#2

What GET command are you using now?


#3

Here is a quick piston which grabs the current “Water Level”, and stores it in the variable {level}

You can import it, and press Test to see the results.


Note:

  • The 16 is how many characters is in {preString}
  • The 6 is how many characters is in the actual level

(I realize I could have condensed the code into fewer lines, but it is easier to grasp when broken down)


Keep in mind:
The above code works for water levels 100.00 thru 999.99. If it goes outside that range, a more complex code would need to be written to account for the lost (or extra) digit


Edit:
1000.0 thru 9999.9 would probably still be OK using 6 characters…
(as long as you’re happy with only a single decimal for that range)


#4

You can learn more about indexOf() and mid() on this Wiki page.


#5

This is awesome and helps a ton with figuring out how to do this. Thank you very much for everybodys help!!


#6

Glad to be able to help…

Feel free to pic a post as the solution if it helped.