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

Re: Action to fill WUHU variable

Expand Messages
  • patkern
    Hi, Don. Yes, I ll get that posted later tonight when I get home. I use VB.NET, as well, but all of my METAR scripts are on a Linux server so PHP is the
    Message 1 of 9 , Jun 22, 2013
    • 0 Attachment
      Hi, Don. Yes, I'll get that posted later tonight when I get home.

      I use VB.NET, as well, but all of my METAR scripts are on a Linux server so PHP is the native script of choice. :) It also allows for easier uploads to the MySQL server.

      -Pat


      --- In wuhu_software_group@yahoogroups.com, Don Lafferty <don@...> wrote:
      >
      > Can you share the php file that you use? I get it using VB.NET but I would
      > like to see a php implementation.
      >
      > Don
      >
      >
      > On Fri, Jun 21, 2013 at 4:48 PM, wuhu_software <wuhu_software@...>wrote:
      >
      > > **
      > >
      > >
      > >
      > > Can you be more specific about the "METAR results"?
      > >
      > > The observation data that you input is output to the currdat.lst file and
      > > they are available for templates.
      > >
      > > Perhaps you are talking about other METAR data?
      > >
      > >
      > > --- In wuhu_software_group@yahoogroups.com, "patkern" <k7ibc@> wrote:
      > > >
      > > > Certainly. I would like to add the METAR results to WUHU variables that
      > > would then upload via Action.txt for outside web scripts that I am working
      > > on.
      > > >
      > > > The current PHP script that I use to extract the data is at
      > > > http://www.familylegacy.us/wx/xmltest.php
      > > > I would prune that down for the specific fields I need.
      > > >
      > > > I know that WUHU_Tweet does something similar, but I'm hoping to not
      > > have to build an outside application.
      > > >
      > > > Thanks.
      > > >
      > > > --- In wuhu_software_group@yahoogroups.com, "wuhu_software"
      > > <wuhu_software@> wrote:
      > > > >
      > > > >
      > > > > Can you give more details about what it is that you are trying to
      > > accomplish?
      > > > >
      > > > >
      > > > > --- In wuhu_software_group@yahoogroups.com, "patkern" <k7ibc@> wrote:
      > > > > >
      > > > > > Is there an Action that will fill a WUHU variable with the result of
      > > a URL?
      > > > > >
      > > > > > I have a PHP script that will retrieve the plain text result of a
      > > METAR query and would like to include the result in another WUHU Action.
      > > > > >
      > > > > > Thanks in advance.
      > > > > >
      > > > > > -Pat
      > > > > >
      > > > >
      > > >
      > >
      > >
      > >
      >
      >
      >
      > --
      > The day Microsoft starts making vacuum cleaners is the day they start
      > making something that doesn't suck.
      >
    • patkern
      Don, This is the PHP code that I m using to extract the METAR codes from NOAA s XML feed. Format: URL... ?icao=ksjc (no quotes), or no icao for your default
      Message 2 of 9 , Jun 22, 2013
      • 0 Attachment
        Don,

        This is the PHP code that I'm using to extract the METAR codes from NOAA's XML feed.

        Format: URL... "?icao=ksjc" (no quotes), or no icao for your default station.

        <CODE>

        <?php

        // error_reporting(E_ALL);
        error_reporting(0);

        date_default_timezone_set('America/Los_Angeles');

        if (empty($_GET['icao'])) {
        $icao = "ktcm";
        } else {
        $icao = htmlspecialchars($_GET['icao']);
        }

        // THIS IS CODE FOR EXTRACTING THE SKY & WEATHER TAGS.

        $xml = file_get_contents('http://www.wrh.noaa.gov/mesowest/getobextXml.php?sid=' . strtolower($icao) . '&num=1');
        $x = simplexml_load_string($xml);
        $vars = $x->xpath('/station/ob/variable');
        foreach ($vars as $var) {
        // echo 'var='.(string)$var['var'].' value='.(string)$var['value']."\n";
        $v1 = (string)$var['var'];
        $v2 = (string)$var['value'];
        $skywx[$v1] = $v2;
        }

        $icao = strtoupper($icao);

        // ASSIGNING VALUES FROM THE STRING WILL BE DONE IN THE FOREACH() LOOP.


        $xml2 = file_get_contents('http://www.weather.gov/xml/current_obs/' . strtoupper($icao) . '.xml');
        $x2 = (array)simplexml_load_string($xml2);

        $x2out=strtolower($x2[weather]);


        // END

        print "
        <current_observation>
        <station_icao>$icao</station_icao>
        <metar_wx>$skywx[PRESWEA]</metar_wx>
        <metar_sky>$skywx[SKY]</metar_sky>
        <decoded_wx>$x2out</decoded_wx>
        </current_observation>
        ";

        ?>

        </CODE>


        There's another I use for extracting fields from the raw METAR, but that's really lengthy code.

        -Pat




        --- In wuhu_software_group@yahoogroups.com, "patkern" wrote:
        >
        > Hi, Don. Yes, I'll get that posted later tonight when I get home.
        >
        > I use VB.NET, as well, but all of my METAR scripts are on a Linux server so PHP is the native script of choice. :) It also allows for easier uploads to the MySQL server.
        >
        > -Pat
        >
        >
        > --- In wuhu_software_group@yahoogroups.com, Don Lafferty don@ wrote:
        > >
        > > Can you share the php file that you use? I get it using VB.NET but I would
        > > like to see a php implementation.
        > >
        > > Don
        > >
        > >
        > > On Fri, Jun 21, 2013 at 4:48 PM, wuhu_software wuhu_software@wrote:
        > >
        > > > **
        > > >
        > > >
        > > >
        > > > Can you be more specific about the "METAR results"?
        > > >
        > > > The observation data that you input is output to the currdat.lst file and
        > > > they are available for templates.
        > > >
        > > > Perhaps you are talking about other METAR data?
        > > >
        > > >
        > > > --- In wuhu_software_group@yahoogroups.com, "patkern" wrote:
        > > > >
        > > > > Certainly. I would like to add the METAR results to WUHU variables that
        > > > would then upload via Action.txt for outside web scripts that I am working
        > > > on.
        > > > >
        > > > > The current PHP script that I use to extract the data is at
        > > > > http://www.familylegacy.us/wx/xmltest.php
        > > > > I would prune that down for the specific fields I need.
        > > > >
        > > > > I know that WUHU_Tweet does something similar, but I'm hoping to not
        > > > have to build an outside application.
        > > > >
        > > > > Thanks.
        > > > >
        > > > > --- In wuhu_software_group@yahoogroups.com, "wuhu_software"
        > > > wrote:
        > > > > >
        > > > > >
        > > > > > Can you give more details about what it is that you are trying to
        > > > accomplish?
        > > > > >
        > > > > >
        > > > > > --- In wuhu_software_group@yahoogroups.com, "patkern" wrote:
        > > > > > >
        > > > > > > Is there an Action that will fill a WUHU variable with the result of
        > > > a URL?
        > > > > > >
        > > > > > > I have a PHP script that will retrieve the plain text result of a
        > > > METAR query and would like to include the result in another WUHU Action.
        > > > > > >
        > > > > > > Thanks in advance.
        > > > > > >
        > > > > > > -Pat
        > > > > > >
        > > > > >
        > > > >
        > > >
        > > >
        > > >
        > >
        > >
        > >
        > > --
        > > The day Microsoft starts making vacuum cleaners is the day they start
        > > making something that doesn't suck.
        > >
        >
      • Don Lafferty
        That works very well. Thanks Pat! Don -- The day Microsoft starts making vacuum cleaners is the day they start making something that doesn t suck.
        Message 3 of 9 , Jun 22, 2013
        • 0 Attachment
          That works very well.  Thanks Pat!

          Don


          --
          The day Microsoft starts making vacuum cleaners is the day they start making something that doesn't suck.
        Your message has been successfully submitted and would be delivered to recipients shortly.