Loading ...
Sorry, an error occurred while loading the content.

Pull TX-60 data from weatherdirect in XML

Expand Messages
  • jjwallace
    Does anyone have a way to get your registered TX60 data from weatherdirect? The tx60.aspx page on the weatherdirect site gives a formatted summary of your
    Message 1 of 3 , Jan 23, 2012
    • 0 Attachment
      Does anyone have a way to get your registered TX60 data from weatherdirect? The tx60.aspx page on the weatherdirect site gives a formatted summary of your registered data. I'd like to embed certain values in my own page served up from my own server but other than pulling in the whole tx60.aspx page and then harvesting the values in some perl/regex script there has to be a clean way.

      I've looked through old messages and didn't find this discussion. If this has been covered, please point me to the threads and accept my apology.

      John
    • John Liss
      That s the approach I would take John, unless you have the ability on the back end where you collect the data you could spit something out and include it on
      Message 2 of 3 , Jan 23, 2012
      • 0 Attachment
        That's the approach I would take John, unless you have the ability on
        the back end where you collect the data you could spit something out and
        include it on your page.

        On my site I generate a wxdata.csv from the weather collecting software,
        then upload that to the web server and process the csv and bypass
        weatherunderground or in your case weatherdirect.

        -John


        On 1/23/2012 10:53 AM, jjwallace wrote:
        > Does anyone have a way to get your registered TX60 data from weatherdirect? The tx60.aspx page on the weatherdirect site gives a formatted summary of your registered data. I'd like to embed certain values in my own page served up from my own server but other than pulling in the whole tx60.aspx page and then harvesting the values in some perl/regex script there has to be a clean way.
        >
        > I've looked through old messages and didn't find this discussion. If this has been covered, please point me to the threads and accept my apology.
        >
        > John
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
      • jjwallace
        The data served up from the TX60.asp page is not in XML format (duh) so when I tried to use simpleXML within a PHP script I quickly realized I was going in the
        Message 3 of 3 , Feb 15, 2012
        • 0 Attachment
          The data served up from the TX60.asp page is not in XML format (duh) so when I tried to use simpleXML within a PHP script I quickly realized I was going in the wrong direction.

          I have three TX60 units on my gateway, one of which I don't have the probe attached, so I am getting 5 readings of interest. The following script, which illustrates just a basic operation, will parse the five floating point values off the page and could then be used in your own custom web page however you want.

          A basic comfort with PHP is required, nothing too heavy, but enough to use simple scripts.

          This demo can be viewed at http://www.wallaceweb.org/wxdirect.php

          Here is the critical section of html/php code:

          ============================================================
          <?php

          $request_url = "http://www.weatherdirect.com/TX60.aspx?&wusid=xxxxxx&bxid=yyyyyyyyyy";

          $str = file_get_contents($request_url);

          if (preg_match_all('/[+-]?\d+(\.\d+)/', $str, $matches)) {
          $temps = $matches[0];
          }

          print ("<br />");
          printf ("Probe temperature = %1\$.1f°F <br />", $temps[1]);
          printf ("Room temperature = %1\$.1f°F <br />", $temps[2]);
          printf ("Freezer temperature = %1\$.1f°F <br />", $temps[3]);
          printf ("Basement temperature = %1\$.1f°F <br />", $temps[4]);
          printf ("Outside temperature = %1\$.1f°F <br />", $temps[5]);

          ?>
          ==============================================================
          Obviously change the xxxxxxx and yyyyyyy strings above to your specific account numbers.

          A good developer would include error checking, date & time stamping, etc. but the point is to give anyone a first step in writing their own PHP code.

          I hope this helps someone.

          John
        Your message has been successfully submitted and would be delivered to recipients shortly.