*/ if (!isset($wfo)&&!isset($product)) { $wfo='lix'; $divWidth = '656'; // They are used for testing only $product = "HWO"; $leftMargin = 50; // Left margin to display text $mapPath = './images/'; } /* End of testing code defaults and section to comment out */ if (isset($_POST['wfo'])) { # Are we using AJAX??? $wfo = $_POST['wfo']; # If so, set wfo. if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') { include ('Settings.php'); // AJAX forgets these on localhost! } } if (isset($_POST['divWidth'])) { # Are we using AJAX??? $divWidth = $_POST['divWidth']; # If so, set wfo. if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') { include ('Settings.php'); // AJAX forgets these on localhost! } } if (isset($_POST['product'])) { # Are we using AJAX??? $product = $_POST['product']; # If so, set wfo. if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') { include ('Settings.php'); // AJAX forgets these on localhost! } } if (isset($_POST['leftMargin'])) { # Are we using AJAX??? $leftMargin = $_POST['leftMargin']; # If so, set wfo. if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') { include ('Settings.php'); // AJAX forgets these on localhost! } } if (isset($_POST['mapPath'])) { # Are we using AJAX??? $mapPath = $_POST['mapPath']; # If so, set wfo. if ($_SERVER["REMOTE_ADDR"]=='127.0.0.1') { include ('Settings.php'); // AJAX forgets these on localhost! } } $locationArrays = array( array("afc","AK, Anchorage"), array("afg","AK, Fairbanks"), array("ajk","AK, Juneau"), array("bmx","AL, Birmingham"), array("mob","AL, Mobile"), array("hun","AL, Huntsville"), array("fgz","AZ, Flagstaff"), array("psr","AZ, Phoenix"), array("twc","AZ, Tucson"), array("lzk","AR, Little Rock"), array("eka","CA, Eureka"), array("hnx","CA, Hanford/San Joaquin Vly."), array("lox","CA, Los Angeles/Oxnard"), array("sto","CA, Sacramento"), array("sgx","CA, San Diego"), array("mtr","CA, San Francisco Bay/Monterey"), array("bou","CO, Denver/Boulder"), array("gjt","CO, Grand Junction"), array("pub","CO, Pueblo"), array("jax","FL, Jacksonville"), array("eyw","FL, Key West"), array("mlb","FL, Melbourne"), array("mfl","FL, Miami"), array("tae","FL, Tallahassee"), array("tbw","FL, Tampa Bay Area"), array("ffc","GA, Atlanta/Peachtree City"), array("pq","GU, Tiyan"), array("hnl","HI, Honolulu"), array("boi","ID, Boise"), array("pih","ID, Pocatello"), array("ilx","IL, Lincoln"), array("lot","IL, Chicago"), array("ind","IN, Indianapolis"), array("iwx","IN, Northern Indiana"), array("dmx","IA, Des Moines"), array("dvn","IA, Quad Cities/Davenport"), array("ddc","KS, Dodge City"), array("gld","KS, Goodland"), array("top","KS, Topeka"), array("ict","KS, Wichita"), array("lmk","KY, Louisville"), array("pah","KY, Paducah"), array("lch","LA, Lake Charles"), array("lix","LA, New Orleans"), array("shv","LA, Shreveport"), array("car","ME, Caribou"), array("gyx","ME, Portland"), array("box","MA, Boston/Taunton"), array("dtx","MI, Detroit"), array("apx","MI, Gaylord"), array("grr","MI, Grand Rapids"), array("mqt","MI, Marquette"), array("dlh","MN, Duluth"), array("mpx","MN, Twin Cities/Chanhassen"), array("jan","MS, Jackson"), array("eax","MO, Kansas City"), array("sgf","MO, Springfield"), array("lsx","MO, St. Louis"), array("byz","MT, Billings"), array("ggw","MT, Glasgow"), array("tfx","MT, Great Falls"), array("mso","MT, Missoula"), array("gid","NE, Hastings"), array("lbf","NE, North Platte"), array("oax","NE, Omaha"), array("lkn","NV, Elko"), array("vef","NV, Las Vegas"), array("rev","NV, Reno"), array("abq","NM, Albuquerque"), array("aly","NY, Albany"), array("bgm","NY, Binghamton"), array("buf","NY, Buffalo"), array("okx","NY, New York City/Upton, NY"), array("rah","NC, Raleigh/Durham"), array("mhx","NC, Morehead City"), array("ilm","NC, Wilmington"), array("bis","ND, Bismarck"), array("fgf","ND, Grand Forks"), array("cle","OH, Cleveland"), array("iln","OH, Wilmington/Dayton"), array("oun","OK, Norman"), array("tsa","OK, Tulsa"), array("mfr","OR, Medford"), array("pdt","OR, Pendleton"), array("pqr","OR, Portland"), array("phi","PA, Philadelphia/Mt. Holly, NJ"), array("pbz","PA, Pittsburgh"), array("ctp","PA, State College"), array("sju","PR, San Juan"), array("chs","SC, Charleston"), array("cae","SC, Columbia"), array("gsp","SC, Greenville/Spartanburg"), array("abr","SD, Aberdeen"), array("unr","SD, Rapid City"), array("fsd","SD, Sioux falls"), array("mrx","TN, Knoxville/Tri Cities"), array("meg","TN, Memphis"), array("ohx","TN, Nashville"), array("ama","TX, Amarillo"), array("bro","TX, Brownsville"), array("crp","TX, Corpus Christi"), array("fwd","TX, Dallas/Fort Worth"), array("epz","TX, El Paso"), array("hgx","TX, Houston/Galveston"), array("lub","TX, Lubbock"), array("sjt","TX, San Angelo"), array("ewx","TX, San Antonio/Austin"), array("slc","UT, Salt Lake City"), array("btv","VT, Burlington"), array("rnk","VA, Roanoke/Blacksburg"), array("akq","VA, Wakefield"), array("sew","WA, Seattle/Tacoma"), array("otx","WA, Spokane"), array("lwx","MD, Washington/Baltimore"), array("rlx","WV, Charleston"), array("grb","WI, Green Bay"), array("arx","WI, La Crosse"), array("mkx","WI, Milwaukee"), array("cys","WY, Cheyenne"), array("riw","WY, Riverton") ); foreach ($locationArrays as $key => $val) { if ($val[0] === $wfo) { $wfoText = $locationArrays[$key][1]; break; } } $matches = preg_split("/[,]+/",$wfoText); $city = trim($matches[1]); $state = $matches[0]; $wfoText = $city.', '.$state; ?> $val) { if ($val[0] == $product) { $productText = $productArrays[$key][1]; break; } } ?>

for

To Select Another NWS Office Click on Map or Choose from List

County Warning Area MAP
Select Forecast Office:   Select Product:  
\n"; $cacheName = $cacheFileDir . $cacheName; // refresh cached copy of page if needed // fetch/cache code by Tom at carterlake.org if (file_exists($cacheName) and filemtime($cacheName) + $refetchSeconds > time()) { $Status .= "\n"; $html = implode('', file($cacheName)); } else { print "\n"; $html = FD_fetchUrlWithoutHanging($fileName); $fp = fopen($cacheName, "w"); if ($fp) { $write = fputs($fp, $html); fclose($fp); $Status .= "\n"; } else { $Status .= "\n"; } } // extract the forecast discussion preg_match('|]*>(.*)|Usi',$html,$matches); $discussion = isset($matches[1])?$matches[1]:''; // now have the forecast as a string with \n delimiters if (strlen($discussion)) $discussion = trim($matches[1]); // prevent extra white space at beginning and end // uncomment next line if you like only lower case text, or it could be made an option // $discussion = strtolower(trim($matches[1])); print $Status; if ($discussion == '') { $discussion = 'NWS '.$productText.' for '.$wfoText.' currently not available.'; } ?>
\n"; print htmlspecialchars(strip_tags($discussion)); print "\n"; $niceFileName = preg_replace('!&!is','&',$fileName);?>
Previous ".$productText."s may be found at
NWS $wfoText ($wfo) Office ".$productText."s.
(Click 'Previous Version' there to view past versions successively.
Some may differ only in time posted.)

\n"; ?>
\n"; $ch = curl_init(); // initialize a cURL session curl_setopt($ch, CURLOPT_URL, $theURL); // connect to provided URL curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // don't verify peer certificate curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (forecast-discussion.php - saratoga-weather.org)'); curl_setopt($ch,CURLOPT_HTTPHEADER, // request LD-JSON format array ( "Accept: text/html,text/plain" )); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $numberOfSeconds); // connection timeout curl_setopt($ch, CURLOPT_TIMEOUT, $numberOfSeconds); // data timeout curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the data transfer curl_setopt($ch, CURLOPT_NOBODY, false); // set nobody curl_setopt($ch, CURLOPT_HEADER, true); // include header information // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow Location: redirect // curl_setopt($ch, CURLOPT_MAXREDIRS, 1); // but only one time if (isset($needCookie[$domain])) { curl_setopt($ch, $needCookie[$domain]); // set the cookie for this request curl_setopt($ch, CURLOPT_COOKIESESSION, true); // and ignore prior cookies $Status .= "\n"; } $data = curl_exec($ch); // execute session if(curl_error($ch) <> '') { // IF there is an error $Status .= "\n"; // display error notice } $cinfo = curl_getinfo($ch); // get info on curl exec. /* curl info sample Array ( [url] => http://saratoga-weather.net/clientraw.txt [content_type] => text/plain [http_code] => 200 [header_size] => 266 [request_size] => 141 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.125 [namelookup_time] => 0.016 [connect_time] => 0.063 [pretransfer_time] => 0.063 [size_upload] => 0 [size_download] => 758 [speed_download] => 6064 [speed_upload] => 0 [download_content_length] => 758 [upload_content_length] => -1 [starttransfer_time] => 0.125 [redirect_time] => 0 [redirect_url] => [primary_ip] => 74.208.149.102 [certinfo] => Array ( ) [primary_port] => 80 [local_ip] => 192.168.1.104 [local_port] => 54156 ) */ $Status .= "\n"; //$Status .= "\n"; curl_close($ch); // close the cURL session //$Status .= "\n"; $i = strpos($data,"\r\n\r\n"); $headers = substr($data,0,$i); $content = substr($data,$i+4); if($cinfo['http_code'] <> '200') { $Status .= "\n"; } return $data; // return headers+contents } else { // print "\n"; $STRopts = array( 'http'=>array( 'method'=>"GET", 'protocol_version' => 1.1, 'header'=>"Cache-Control: no-cache, must-revalidate\r\n" . "Cache-control: max-age=0\r\n" . "Connection: close\r\n" . "User-agent: Mozilla/5.0 (forecast-discussion.php - saratoga-weather.org)\r\n" . "Accept: text/html,text/plain\r\n" ), 'https'=>array( 'method'=>"GET", 'protocol_version' => 1.1, 'header'=>"Cache-Control: no-cache, must-revalidate\r\n" . "Cache-control: max-age=0\r\n" . "Connection: close\r\n" . "User-agent: Mozilla/5.0 (forecast-discussion.php - saratoga-weather.org)\r\n" . "Accept: text/html,text/plain\r\n" ) ); $STRcontext = stream_context_create($STRopts); $T_start = FD_fetch_microtime(); $xml = file_get_contents($url,false,$STRcontext); $T_close = FD_fetch_microtime(); $headerarray = get_headers($url,0); $theaders = join("\r\n",$headerarray); $xml = $theaders . "\r\n\r\n" . $xml; $ms_total = sprintf("%01.3f",round($T_close - $T_start,3)); $Status .= "\n"; $Status .= "<-- get_headers returns\n".$theaders."\n -->\n"; // print " file() stats: total=$ms_total secs.\n"; $overall_end = time(); $overall_elapsed = $overall_end - $overall_start; $Status .= "\n"; // print "fetch function elapsed= $overall_elapsed secs.\n"; return($xml); } } // end FD_fetchUrlWithoutHanging // ------------------------------------------------------------------ function FD_fetch_microtime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } // ---------------------------------------------------------- // --------------end of functions --------------------------------------- ?>
San Juan, PRHonolulu, HI Lake Charles, LA Pueblo, CO Corpus Christi, TX St. Louis, MO Reno, NV Raleigh, NC  Newport/Morehead City, NC Dodge City, KS Houston/Galveston, TX San Joaquin Valley/Hanford, CA Louisville, KY Fort Worth, TX Pittsburgh, PA Austin/San Antonio, TX Sacramento, CA Jackson, MS Phoenix, AZ Northern Indiana, IN Flagstaff, AZ Tallahassee, FL Springfield, MO Riverton, WY Blacksburg, VA Sioux Falls, SD El Paso Area, NM Columbia, SC Wilmington, NC Greenville-Spartanburg, SC Eureka, CA Midland/Odessa, TX Tucson, AZ Goodland, KS Huntsville, AL Amarillo, TX Norman, OK Lubbock, TX Marquette, MI Little Rock, AR Pendleton, OR Missoula, MT Binghamton, NY Boston, MA Green Bay, WI Billings, MT Baltimore/Washington San Diego, CA Tampa Bay, FL Morristown, TN Twin Cities, MN Brownsville, TX Portland, OR Des Moines, IA Memphis, TN Pocatello, ID San Angelo, TX Jacksonville, FL Aberdeen, SD Quad Cities, IA/IL Charleston, SC New Orleans/Baton Rouge, LA Peachtree City, GA Shreveport, LA Grand Rapids, MI Medford, OR Albany, NY Wichita, KS Gray/Portland, ME Spokane, WA Boise, ID Denver/Boulder, CO Great Falls, MT Caribou, ME Key West, FL Miami-South Florida, FL New York City/Upton, NY Melbourne, FL Hastings, NE Paducah, KY Glasgow, MT Bismarck, ND Charleston WV Omaha/Valley, NE Buffalo, NY Jackson, KY Kansas City/Pleasant Hill, MO Gaylord, MI Cheyenne, WY Grand Forks, ND Detroit/Pontiac, MI Central Illinois, IL Burlington, VT Salt Lake City, UT Topeka, KS Nashville, TN Milwaukee/Sullivan, WI Albuquerque, NM Las Vegas, NV Wakefield, VA La Crosse, WI Birmingham, AL Los Angeles/Oxnard, CA Chicago, IL Seattle, WA Rapid City, SD Indianapolis, IN Philadelphia/Mount Holly, PA Mobile/Pensacola State College, PA Cleveland, OH Elko, NV Wilmington, OH Grand Junction, CO North Platte, NE Tulsa, OK San Francisco/Monterey Bay Area, CA Duluth, MN Anchorage, AK Fairbanks, AK Juneau, AK Tiyan, GU