G4ZFE WWV Data Grabber

This PHP program allows you to display WWV data from http://www.sel.noaa.gov on your own web pages.

An example of its use is G4ZFE Solar Page

Requirements

To run the WWV grabber your web site must allow the use of PHP.

To test if you can use PHP copy the following code and create an info.php file. Copy the info.php file to your web server and open it up with a browser. Remember that it is a .php file and not a .html file.

<?php
// Show PHP settings on your web server
phpinfo();
?>

If the above PHP program works then your web server has PHP support. If not, then the WWV PHP grabber will not work!

PHP WWV Grabber

The complete HTML page below shows how to display the current WWV data on your own web page.

Copy the HTML and PHP below and save it in a file called solar.php. Copy the solar.php file to your web server and open it with a browser. If your server supports PHP then the latest WWV data from http://www.sel.noaa.gov will be displayed.

<HTML>
<TITLE>Current Solar Data
</HEAD>
<BODY>
<?php
Class wwv 
{
  var $file;
  var $wwv_file;
  var $display_data;

  function wwv_alert()
  {
    // Read WWV alert data
    $file = fopen("http://www.sel.noaa.gov/ftpdir/latest/wwv.txt", "r"); 
    $wwv_file = fread($file, 100);  

    // Skip header info
    $display_data = eregi("Solar(.*)$", $wwv_file, $wwv_array);
    fclose($file); 

    // Display WWV alert data
    print ("<TABLE BORDER=\"0\" CELLPADDING=\"10\" CELLSPACING=\"10\">");
    print ("<TR> <TD BGCOLOR=\"lightyellow\">");
    print ("<PRE>Solar");
    echo $wwv_array[1]; 
    print ("</PRE>");
    print ("</TD> </TR> </TABLE>");
  }
}
?>

<CENTER><H1>Current Solar Data</H1></CENTER>
<P>

<?php
$today_wwv = new wwv ();
print ("<H2>Latest WWV Alert Message</H2>\n");
$today_wwv->wwv_alert ();
?>

</BODY>
</HTML>

Enhancements

The above example can be modified to grab any HTML pages.

< Return to G4ZFE