Wind Feed Parser
This script is designed to read the xml wind feed from the PierToPier.net wind sensor. Can be used to display the wind speed direction and strength of the last gust on any php based page.
USAGE
Needs no inputs, the address for the xml feeds at the top if it ever needs  changing.
 The out put is in the form of three variables. $speed, $ direction and $gust.  they are a numbers corresponding to the wind speed, wind direction and strength  of he strongest gust received in the preceding 5 minutes. In knots and  degrees.
CODE
            // Piertopier.net xml wind feed script
             // opens a connection for piertopier.net's xmlfeed, rips it
 up and returns:
             // $speed as the current wind speed in knots, $direction is
 a bearing in degrees, $gust is the  strength of the last gust in knots.
 // opens connection to piertopier for current xml feed  of wind  speed.                                                       
 $host =  'www.piertopier.net';
 $uri = 'weather.xml';
             $fp = fsockopen($host, 80, $errno, $errstr, 20);
                         if (!$fp) {
                                     die("Network error: $errstr ($errno)");
                         } else {
                                                 $xml = '';
                                                 fputs($fp, "GET /$uri HTTP/1.0 Host: $host ");
                                                 while (!feof($fp)) {
                                                 $xml .= fgets($fp, 128);
                                                                                                             }
                                                 fclose ($fp);
                                                 }
 // clears out unwanted  sections from the XML feed.
 $search = array ("'HTTP[^>]*?>.*?knots='si", // Strip out  everything up to wind speed
                   "'mph[^>]*?>.*?knots='si", // Strip out everything between  windspeed and gust speed
                   "'mph[^>]*?>.*?degrees='si", // Strip out every hting between gust speed and direction
                   "'[^>]*?>.*?rtList>'si", // strip out everything after direction
                   "'/>'i"); // Strips out irritating left over /> that I can't figure
 $replace = array ("", //replace all the above with nothing!
                    "",
                   "",
                   "",
                   "",
                   "",
                   "",
                   "",
                  	"");
             $xml = preg_replace ($search, $replace, $xml);
 // stip out the Quotation Marks
              $xml = ereg_replace('"', "", $xml);
 // chops the xml feed up and stuffs it in an array
             $pieces = explode(" ", $xml);
 // gets the right chunks of the array and assigns them to variables for display
 called speed direction and gust 
             $speed = $pieces[0];
             $direction = $pieces[2];
             $gust = $pieces[1];
 
     
     
 
 
 
 
    WALLPAPERS
 WALLPAPERS PHOTOS
 PHOTOS