0

What I'm trying to do is parse a data table from this link and similar links on the site. Basically it shows the water levels in different parts of Ontario. I want to get the data table and make my own graph.

Can someone point me in a direction to do this? Is it possible to do without PHP?

Target link

DontVoteMeDown
  • 21,122
  • 10
  • 69
  • 105
Matty chom
  • 37
  • 3
  • In PHP - http://php.net/manual/en/function.parse-str.php. There's also `client side` alternatives, such as Javascript - http://stackoverflow.com/a/901144/2470724 – Nick R Jun 27 '13 at 13:23
  • No, without PHP. Because you cannot make a CORS call. – Atif Jun 27 '13 at 13:28
  • Or use a php dom parser like this http://simplehtmldom.sourceforge.net/ – Pitchinnate Jun 27 '13 at 13:29
  • I put together a sample js fiddle to demonstrate how to parse this specific kind of data this does not solve the problem of obtaining the data itself though. http://jsfiddle.net/gf239/2/ – Andrea Scarcella Jun 27 '13 at 13:40

1 Answers1

1

Is it possible to do without PHP? Absolutely!

I suggest using Yahoo! Query Language (YQL).

What is YQL?

The Yahoo! Query Language is an expressive SQL-like language that lets you query, filter, and join data across Web services. With YQL, apps run faster with fewer lines of code and a smaller network footprint.

-- YQL Homepage

Just take a look at YQL Console, there's some nice examples at the bottom of the right panel which titled by DATA TABLES.

Another thing that makes me feel is the awesome THE REST QUERY feature.

You can use this API to get access to the query result in XML or JSON format.

There's also a full documented user guide you can use to find your answers.

Just give it a try, and I promise you will ♥ that.

Hashem Qolami
  • 97,268
  • 26
  • 150
  • 164
  • I am trying to do this with YQL, but I get stuck because I must submit I agree to a disclaimer before I can view the data. I have also tried... select * from html where url='http://www.wateroffice.ec.gc.ca/graph/graph_e.html?stn=04ME003' so it just queries the disclaimer and not the data, any idea how to bypass or accept the disclaimer. I have tried select * from htmlpost where url='http://www.wateroffice.ec.gc.ca/graph/graph_e.html?stn=04ME003/include/disclaimer.php' and postdata="disclaimer_action=I Agree" and xpath="//p/input" – Matty chom Jun 27 '13 at 19:08
  • This question is voted to be off-topic, please update it with: _what you've tried to do_, _why it didn't work?_ – Hashem Qolami Jun 27 '13 at 19:34