// // (see the files README and COPYING for more details) // // You need to take this file and rename it to whatever page name // you want. Then fill in the configuration information and then drop // all the way to the bottom of the page and design up the output. // // See wx200.php and box.php in the examples directory $host = "127.0.0.1"; $port = "9753"; $wait = 15; // how many seconds you willing to wait if server is down? $degree_type = 'F'; // F=fahrenheit C=celsius $wind_type = '2'; // 0=mph, 1=knots, 2=m/s, 3=kph $barom_type = '3'; // 0=in, 1=mm, 2=mb, 3=hpa ///////// Skip to DISPLAY section to finish your customization /////// include("misc.inc"); include("humidity.inc"); include("temp.inc"); include("barom.inc"); include("rain.inc"); include("wind.inc"); include("time.inc"); // open a client connection $fp = fsockopen ($host, $port, $errno, $errstr,$wait); if (!$fp) { $result = "Unable to Connect to wx200d server: $errno: $errstr"; } else { for($i=1;$i<147;$i++) { // we need 146 bytes, no more no less $result.=fread($fp,1); } fclose($fp); $array = unpack('C*',$result); $end=1; $array = array_splice($array,0,-1); // dont need the first byte while($end) { // loop until we hit last DTP group $group = $array[0]; $dtp = $wx_datatype{$group}; $length = $wx_length{$group}; if (!$dtp) { $end=0; } // grab the $length number of bytes $array2 = array_splice($array,0,$length); if ($dtp == "humid") { $humidity_array = wx200_humidity($array2); } elseif ( $dtp == "temp") { $temp_array = wx200_temp($array2); } elseif ( $dtp == "barom") { $barom_array = wx200_barom($array2); } elseif ( $dtp == "rain") { $rain_array = wx200_rain($array2); } elseif ( $dtp == "wind") { $wind_array = wx200_wind($array2); } elseif ( $dtp == "time") { $time_array = wx200_time($array2); } } } //////////////////////// /// DISPLAY SECTION //// //////////////////////// // Put your code here. Using the various arrays that are set by the code // above. See USAGE_VARIABLES for a list of them or see wx200.php and // box.php in the examples directory //////////////////////// ?>