Advertisement
trupsalms

nv-weather-google.php

Mar 15th, 2013
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.86 KB | None | 0 0
  1. #!/usr/bin/php -q
  2. <?
  3. ob_implicit_flush(false);
  4. error_reporting(0);
  5. set_time_limit(300);
  6.  
  7. // Nerd Vittles ZIP Weather ver. 5.0, (c) Copyright Ward Mundy, 2007-2012. All rights reserved.
  8.  
  9. // This software is licensed under the GPL2 license.
  10. //
  11. // Material alteration of the spoken content provided by this application is strictly prohibited.
  12. //
  13. // For a copy of license, visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  14. //
  15. // For additional information, contact us: http://pbxinaflash.com/about/comment.php
  16.  
  17.  
  18.  
  19. //-------- DON'T CHANGE ANYTHING ABOVE THIS LINE ----------------
  20.  
  21.  
  22. // You can change the Canadian cities and Postal Codes below to meet your needs.
  23. // 0-9 are used to match ZIP Codes 00000 through 00009 entered by telephone.
  24. // No ZIP codes above 00009 are safe to tinker with. Reserved for use by USPS.
  25. // Make sure you pick legitimate Canadian postal codes. There's NO error checking.
  26. // Test code with a browser first, e.g. http://www.google.com/ig/api?weather=K1N6N5
  27.  
  28. $canada[0] = "K1N6N5" ; // Ottawa
  29. $canada[1] = "V5K0A1" ; // Vancouver
  30. $canada[2] = "T1L1B8" ; // Banff
  31. $canada[3] = "T6P1X2" ; // Edmonton
  32. $canada[4] = "B3P2L5" ; // Halifax
  33. $canada[5] = "N5V0A5" ; // London
  34. $canada[6] = "H2Y1C6" ; // Montreal
  35. $canada[7] = "G1C2X4" ; // Quebec City
  36. $canada[8] = "M3H6A7" ; // Toronto
  37. $canada[9] = "R2C0A1" ; // Winnipeg
  38.  
  39. $debug = 1;
  40. $newlogeachdebug = 1;
  41. $emaildebuglog = 0;
  42. $email = "yourname@yourdomain" ;
  43.  
  44. //-------- DON'T CHANGE ANYTHING BELOW THIS LINE ----------------
  45.  
  46. $states_name = array('AL'=>"Alabama",'AK'=>"Alaska",'AZ'=>"Arizona",'AR'=>"Arkansas",'CA'=>"California",'CO'=>"Colorado",'CT'=>"Connecticut",'DE'=>"Delaware",'FL'=>"Florida",'GA'=>"Georgia",'HI'=>"Hawaii",'ID'=>"Idaho",'IL'=>"Illinois", 'IN'=>"Indiana", 'IA'=>"Iowa", 'KS'=>"Kansas",'KY'=>"Kentucky",'LA'=>"Louisiana",'ME'=>"Maine",'MD'=>"Maryland", 'MA'=>"Massachusetts",'MI'=>"Michigan",'MN'=>"Minnesota",'MS'=>"Mississippi",'MO'=>"Missouri",'MT'=>"Montana",'NE'=>"Nebraska",'NV'=>"Nevada",'NH'=>"New Hampshire",'NJ'=>"New Jersey",'NM'=>"New Mexico",'NY'=>"New York",'NC'=>"North Carolina",'ND'=>"North Dakota",'OH'=>"Ohio",'OK'=>"Oklahoma", 'OR'=>"Oregon",'PA'=>"Pennsylvania",'RI'=>"Rhode Island",'SC'=>"South Carolina",'SD'=>"South Dakota",'TN'=>"Tennessee",'TX'=>"Texas",'UT'=>"Utah",'VT'=>"Vermont",'VA'=>"Virginia",'WA'=>"Washington",'DC'=>"Washington D.C.",'WV'=>"West Virginia",'WI'=>"Wisconsin",'WY'=>"Wyoming",'AB'=>"Alberta",'BC'=>"British Columbia",'MB'=>"Manitoba",'NB'=>"New Brunswick",'WY'=>"Wyoming",'NL'=>"Newfoundland",'WY'=>"Wyoming",'NT'=>"Northwest Territories",'NS'=>"Nova Scotia",'NU'=>"Nunavut",'ON'=>"Ontario",'PE'=>"Prince Edward Island",'QC'=>"Quebec",'SK'=>"Saskatchewan",'YT'=>"Yukon");
  47. $states_abbr = array();
  48. foreach ($states_name as $abbr => $state) {
  49. $states_abbr[$state] = $abbr ;
  50. }
  51. $day_of_week = array('Sunday'=>"Sun",'Monday'=>"Mon",'Tuesday'=>"Tue",'Wednesday'=>"Wed",'Thursday'=>"Thu",'Friday'=>"Fri",'Saturday'=>"Sat");
  52.  
  53.  
  54. function fulldow($val) {
  55. global $day_of_week;
  56. $value = array_keys($day_of_week,$val);
  57. $val= $value[0] ;
  58. return $val ;
  59. }
  60.  
  61. function state($val) {
  62. global $states_name, $states_abbr;
  63. $value = array_keys($states_abbr,$val);
  64. $val= $value[0] ;
  65. return $val ;
  66. }
  67.  
  68.  
  69. $log = "/var/log/asterisk/nv-weather-google.txt" ;
  70. if ($debug and $newlogeachdebug) :
  71. if (file_exists($log)) :
  72. unlink($log) ;
  73. endif ;
  74. endif ;
  75.  
  76. $stdlog = fopen($log, 'a');
  77. $stdin = fopen('php://stdin', 'r');
  78. $stdout = fopen( 'php://stdout', 'w' );
  79.  
  80. if ($debug) :
  81. fputs($stdlog, "Nerd Vittles Google Weather ver. 5.0 (c) Copyright 2007-2012, Ward Mundy. All Rights Reserved.\n\n" . date("F j, Y - H:i:s") . " *** New session ***\n\n" );
  82. endif ;
  83.  
  84. function read() {
  85. global $stdin;
  86. $input = str_replace("\n", "", fgets($stdin, 4096));
  87. dlog("read: $input\n");
  88. return $input;
  89. }
  90.  
  91. function write($line) {
  92. dlog("write: $line\n");
  93. echo $line."\n";
  94. }
  95.  
  96. function dlog($line) {
  97. global $debug, $stdlog;
  98. if ($debug) fputs($stdlog, $line);
  99. }
  100.  
  101. function execute_agi( $command )
  102. {
  103. GLOBAL $stdin, $stdout, $stdlog, $debug;
  104.  
  105. fputs( $stdout, $command . "\n" );
  106. fflush( $stdout );
  107. if ($debug)
  108. fputs( $stdlog, $command . "\n" );
  109.  
  110. $resp = fgets( $stdin, 4096 );
  111.  
  112. if ($debug)
  113. fputs( $stdlog, $resp );
  114.  
  115. if ( preg_match("/^([0-9]{1,3}) (.*)/", $resp, $matches) )
  116. {
  117. if (preg_match('/result=([-0-9a-zA-Z]*)(.*)/', $matches[2], $match))
  118. {
  119. $arr['code'] = $matches[1];
  120. $arr['result'] = $match[1];
  121. if (isset($match[3]) && $match[3])
  122. $arr['data'] = $match[3];
  123. return $arr;
  124. }
  125. else
  126. {
  127. if ($debug)
  128. fputs( $stdlog, "Couldn't figure out returned string, Returning code=$matches[1] result=0\n" );
  129. $arr['code'] = $matches[1];
  130. $arr['result'] = 0;
  131. return $arr;
  132. }
  133. }
  134. else
  135. {
  136. if ($debug)
  137. fputs( $stdlog, "Could not process string, Returning -1\n" );
  138. $arr['code'] = -1;
  139. $arr['result'] = -1;
  140. return $arr;
  141. }
  142. }
  143.  
  144. // ------ Code execution begins here
  145. // parse agi headers into array
  146. //while ($env=read()) {
  147. // $s = split(": ",$env);
  148. // $agi[str_replace("agi_","",$s0)] = trim($s1);
  149. // if (($env == "") || ($env == "\n")) {
  150. // break;
  151. // }
  152. //}
  153.  
  154. while ( !feof($stdin) )
  155. {
  156. $temp = fgets( $stdin );
  157.  
  158. if ($debug)
  159. fputs( $stdlog, $temp );
  160.  
  161. // Strip off any new-line characters
  162. $temp = str_replace( "\n", "", $temp );
  163.  
  164. $s = explode( ":", $temp );
  165. $agivar[$s[0]] = trim( $s[1] );
  166. if ( ( $temp == "") || ($temp == "\n") )
  167. {
  168. break;
  169. }
  170. }
  171.  
  172. $zip = $_SERVER["argv"][1];
  173. $zip=trim($zip);
  174.  
  175. $zip = str_replace( "letter eye", "i", $zip);
  176. $zip = str_replace( "letter to", "q", $zip);
  177. $zip = str_replace( "letter im", "m", $zip);
  178. $zip = str_replace( "letter in", "n", $zip);
  179. $zip = str_replace( "letter and", "n", $zip);
  180. $zip = str_replace( "letter page", "h", $zip);
  181. $zip = str_replace( "letter you", "u", $zip);
  182. $zip = str_replace( "letter text", "x", $zip);
  183.  
  184. $zip = str_replace( "zero ", "0 ", $zip);
  185. $zip = str_replace( "one ", "1 ", $zip);
  186. $zip = str_replace( "won ", "1 ", $zip);
  187. $zip = str_replace( "two ", "2 ", $zip);
  188. $zip = str_replace( "too ", "2 ", $zip);
  189. $zip = str_replace( "to ", "2 ", $zip);
  190. $zip = str_replace( "tube ", "2 ", $zip);
  191. $zip = str_replace( "three ", "3 ", $zip);
  192. $zip = str_replace( "four ", "4 ", $zip);
  193. $zip = str_replace( "fore ", "4 ", $zip);
  194. $zip = str_replace( "five ", "5 ", $zip);
  195. $zip = str_replace( "six ", "6 ", $zip);
  196. $zip = str_replace( "sex ", "6 ", $zip);
  197. $zip = str_replace( "sixth ", "6 ", $zip);
  198. $zip = str_replace( "seven ", "7 ", $zip);
  199. $zip = str_replace( "eight ", "8 ", $zip);
  200. $zip = str_replace( "ate ", "8 ", $zip);
  201. $zip = str_replace( "nine ", "9 ", $zip);
  202.  
  203. $zip = str_replace( "letters", "", $zip);
  204. $zip = str_replace( "letter", "", $zip);
  205.  
  206. $zip = str_replace( "numbers", "", $zip);
  207. $zip = str_replace( "number", "", $zip);
  208. $zip = str_replace( "x ray", "xray", $zip);
  209. $zip = str_replace( "x-ray", "xray", $zip);
  210. $zip = str_replace( "fanatic", "phonetic", $zip);
  211. $zip = str_replace( "fanatics", "phonetic", $zip);
  212.  
  213. if ( strpos($zip,"phonetic")>0 or substr($zip,0,8)=="phonetic" ) :
  214. $zip = str_replace( "phonetic ", "", $zip);
  215. $zip = str_replace( "phonetic", "", $zip);
  216. $pos=0;
  217. $newzip=$zip." ";
  218. $m=strpos($newzip," ");
  219. while ($m<>0){
  220. $testword = substr($newzip,0,$m);
  221. echo $testword;
  222. echo chr(10);
  223. if (strlen($testword)>1):
  224. $zip = str_replace( $testword, substr($testword,0,1), $zip);
  225. endif;
  226. $newzip=substr($newzip,$m+1);
  227. $m=strpos($newzip," ");
  228. }
  229. $zip = str_replace( " ", "", $zip);
  230. if (strlen($zip)>6) :
  231. $zip=substr($zip,0,6);
  232. endif ;
  233. endif;
  234.  
  235. if ( $zip=="0" or $zip=="1" or $zip=="2" or $zip=="3" or $zip=="4" or $zip=="5" or $zip=="6" or $zip=="7" or $zip=="8" or $zip=="9" ):
  236. $zip2=$canada[$zip];
  237. $zip=$zip2;
  238. endif;
  239.  
  240. if ($debug) :
  241. fputs($stdlog, "Location: " . $zip . "\n" );
  242. endif ;
  243.  
  244.  
  245. $query = "http://www.google.com/ig/api?weather=$zip";
  246. $query = trim(str_replace( " ", "%20", $query));
  247.  
  248.  
  249. $fd = fopen($query, "r");
  250. if (!$fd) {
  251. echo "<p>Unable to open web connection. \n";
  252. exit;
  253. }
  254. $value = "";
  255. while(!feof($fd)){
  256. $value .= fread($fd, 4096);
  257. }
  258. fclose($fd);
  259.  
  260. $found=strpos($value,"problem_cause");
  261. if ($found>0) :
  262. if ( substr($zip,0,4)=="0000" ) :
  263. $city = substr($zip,4,1);
  264. $zip = $canada[$city];
  265. $query = "http://www.google.com/ig/api?weather=$zip";
  266. $fd = fopen($query, "r");
  267. if (!$fd) {
  268. echo "<p>Unable to open web connection. \n";
  269. exit;
  270. }
  271. $value = "";
  272. while(!feof($fd)){
  273. $value .= fread($fd, 4096);
  274. }
  275. fclose($fd);
  276. else :
  277. $zip=substr($zip,0,1).".".substr($zip,1,1).".".substr($zip,2,1).".".substr($zip,3,1).".".substr($zip,4,1);
  278. $msg=chr(34)."I'm sorry but no weather data is available for $zip. Thank you for calling. Goodbye.".chr(34);
  279. // echo $msg;
  280. // echo chr(10);
  281. execute_agi("SET VARIABLE WEATHER $msg");
  282. exit;
  283. endif;
  284. endif;
  285.  
  286. //echo $value;
  287. //echo chr(10).chr(10);
  288.  
  289. $thetext="<city data=";
  290. $endtext=chr(34)."/>";
  291. $start= strpos($value, $thetext);
  292. //echo $start . chr(10);
  293. $tmptext = substr($value,$start+strlen($thetext)+1);
  294. //echo $start+strlen($thetext)+1;
  295. //echo chr(10);
  296. $end=strpos($tmptext, $endtext);
  297. //echo $end . chr(10);
  298. $location = substr($tmptext,0,$end);
  299. //echo $location;
  300. $abbrev = substr($location,strlen($location)-2);
  301. $location = substr($location,0,strlen($location)-2).state($abbrev);
  302.  
  303. $location = "This weather forecast for $location brought to you by Google and Nerd Vittles. ";
  304. //echo $location.chr(10);
  305.  
  306.  
  307. $thetext="<temp_f data=";
  308. $endtext=chr(34)."/>";
  309. $start= strpos($value, $thetext);
  310. //echo $start . chr(10);
  311. $tmptext = substr($value,$start+strlen($thetext)+1);
  312. //echo $start+strlen($thetext)+1;
  313. //echo chr(10);
  314. $end=strpos($tmptext, $endtext);
  315. //echo $end . chr(10);
  316. $tempf = substr($tmptext,0,$end);
  317. //echo $tempf;
  318. //echo chr(10);
  319.  
  320. $thetext="<temp_c data=";
  321. $endtext=chr(34)."/>";
  322. $start= strpos($value, $thetext);
  323. //echo $start . chr(10);
  324. $tmptext = substr($value,$start+strlen($thetext)+1);
  325. //echo $start+strlen($thetext)+1;
  326. //echo chr(10);
  327. $end=strpos($tmptext, $endtext);
  328. //echo $end . chr(10);
  329. $tempc = substr($tmptext,0,$end);
  330. //echo $tempc;
  331. //echo chr(10);
  332.  
  333. $temperature="Current temperature: $tempf degrees fahrenheit. $tempc degrees centigrade. ";
  334. //echo $temperature;
  335. //echo chr(10);
  336.  
  337. $thetext="<humidity data=";
  338. $endtext=chr(34)."/>";
  339. $start= strpos($value, $thetext);
  340. //echo $start . chr(10);
  341. $tmptext = substr($value,$start+strlen($thetext)+1);
  342. //echo $start+strlen($thetext)+1;
  343. //echo chr(10);
  344. $end=strpos($tmptext, $endtext);
  345. //echo $end . chr(10);
  346. $humidity = substr($tmptext,0,$end);
  347. $humidity = "Relative ".str_replace( "%", " per cent. ", $humidity );
  348. //echo $humidity;
  349. //echo chr(10);
  350.  
  351. $thetext="<wind_condition data=";
  352. $endtext=chr(34)."/>";
  353. $start= strpos($value, $thetext);
  354. //echo $start . chr(10);
  355. $tmptext = substr($value,$start+strlen($thetext)+1);
  356. //echo $start+strlen($thetext)+1;
  357. //echo chr(10);
  358. $end=strpos($tmptext, $endtext);
  359. //echo $end . chr(10);
  360. $wind = substr($tmptext,0,$end);
  361. $wind = str_replace( "Wind", "Wend Direction and Speed", $wind).". ";
  362. $wind = str_replace( " mph", " miles per hour", $wind );
  363. $wind = str_replace( " E ", " From the East ", $wind );
  364. $wind = str_replace( " NE ", " From the North East ", $wind );
  365. $wind = str_replace( " W ", " From the West ", $wind );
  366. $wind = str_replace( " NW ", " From the North West ", $wind );
  367. $wind = str_replace( " N ", " From the North ", $wind );
  368. $wind = str_replace( " S ", " From the South ", $wind );
  369. $wind = str_replace( " SE ", " From the South East ", $wind );
  370. $wind = str_replace( " SW ", " From the South West ", $wind );
  371. //echo $wind;
  372. //echo chr(10);
  373.  
  374. $thetext="<icon data=";
  375. $endtext=chr(34)."/>";
  376. $start= strpos($value, $thetext);
  377. //echo $start . chr(10);
  378. $tmptext = substr($value,$start+strlen($thetext)+1);
  379. //echo $start+strlen($thetext)+1;
  380. //echo chr(10);
  381. $end=strpos($tmptext, $endtext);
  382. //echo $end . chr(10);
  383. $conditions = "Current weather conditions: ".substr($tmptext,19,$end-23).". ";
  384. $conditions = str_replace( "_", " ", $conditions );
  385. //echo $conditions;
  386. //echo chr(10);
  387.  
  388. $thetext="<forecast_conditions>";
  389. $endtext="</forecast_conditions>";
  390. $start= strpos($value, $thetext);
  391. $tmptext = substr($value,$start+strlen($thetext));
  392. $end=strpos($tmptext, $endtext);
  393. $forecast1 = substr($tmptext,0,$end);
  394.  
  395. //echo $forecast1;
  396. //echo chr(10);
  397.  
  398. $value=substr($value,$start+10);
  399.  
  400. $thetext="day_of_week data=";
  401. $endtext=chr(34)."/>";
  402. $start= strpos($value, $thetext);
  403. $tmptext = substr($value,$start+strlen($thetext)+1);
  404. $end=strpos($tmptext, $endtext);
  405. $dow1 = fulldow(substr($tmptext,0,$end));
  406. //echo $dow1;
  407. //echo chr(10);
  408.  
  409. $thetext="low data=";
  410. $endtext=chr(34)."/>";
  411. $start= strpos($value, $thetext);
  412. $tmptext = substr($value,$start+strlen($thetext)+1);
  413. $end=strpos($tmptext, $endtext);
  414. $low1 = substr($tmptext,0,$end);
  415. //echo $low1;
  416. //echo chr(10);
  417.  
  418. $thetext="high data=";
  419. $endtext=chr(34)."/>";
  420. $start= strpos($value, $thetext);
  421. $tmptext = substr($value,$start+strlen($thetext)+1);
  422. $end=strpos($tmptext, $endtext);
  423. $high1 = substr($tmptext,0,$end);
  424. //echo $high1;
  425. //echo chr(10);
  426.  
  427. $thetext="condition data=";
  428. $endtext=chr(34)."/>";
  429. $start= strpos($value, $thetext);
  430. $tmptext = substr($value,$start+strlen($thetext)+1);
  431. $end=strpos($tmptext, $endtext);
  432. $cond1 = substr($tmptext,0,$end);
  433. //echo $cond1;
  434. //echo chr(10);
  435.  
  436. $value= substr($value,$start+10);
  437.  
  438. $thetext="<forecast_conditions>";
  439. $endtext="</forecast_conditions>";
  440. $start= strpos($value, $thetext);
  441. $tmptext = substr($value,$start+strlen($thetext));
  442. $end=strpos($tmptext, $endtext);
  443. $forecast2 = substr($tmptext,0,$end);
  444.  
  445. //echo $forecast2;
  446. //echo chr(10);
  447.  
  448. $thetext="day_of_week data=";
  449. $endtext=chr(34)."/>";
  450. $start= strpos($value, $thetext);
  451. $tmptext = substr($value,$start+strlen($thetext)+1);
  452. $end=strpos($tmptext, $endtext);
  453. $dow2 = fulldow(substr($tmptext,0,$end));
  454. //echo $dow2;
  455. //echo chr(10);
  456.  
  457. $thetext="low data=";
  458. $endtext=chr(34)."/>";
  459. $start= strpos($value, $thetext);
  460. $tmptext = substr($value,$start+strlen($thetext)+1);
  461. $end=strpos($tmptext, $endtext);
  462. $low2 = substr($tmptext,0,$end);
  463. //echo $low2;
  464. //echo chr(10);
  465.  
  466. $thetext="high data=";
  467. $endtext=chr(34)."/>";
  468. $start= strpos($value, $thetext);
  469. $tmptext = substr($value,$start+strlen($thetext)+1);
  470. $end=strpos($tmptext, $endtext);
  471. $high2 = substr($tmptext,0,$end);
  472. //echo $high2;
  473. //echo chr(10);
  474.  
  475. $thetext="condition data=";
  476. $endtext=chr(34)."/>";
  477. $start= strpos($value, $thetext);
  478. $tmptext = substr($value,$start+strlen($thetext)+1);
  479. $end=strpos($tmptext, $endtext);
  480. $cond2 = substr($tmptext,0,$end);
  481. //echo $cond2;
  482. //echo chr(10);
  483.  
  484.  
  485. $value= substr($value,$start+10);
  486.  
  487. $thetext="<forecast_conditions>";
  488. $endtext="</forecast_conditions>";
  489. $start= strpos($value, $thetext);
  490. $tmptext = substr($value,$start+strlen($thetext));
  491. $end=strpos($tmptext, $endtext);
  492. $forecast3 = substr($tmptext,0,$end);
  493.  
  494. //echo $forecast3;
  495. //echo chr(10);
  496.  
  497. $thetext="day_of_week data=";
  498. $endtext=chr(34)."/>";
  499. $start= strpos($value, $thetext);
  500. $tmptext = substr($value,$start+strlen($thetext)+1);
  501. $end=strpos($tmptext, $endtext);
  502. $dow3 = fulldow(substr($tmptext,0,$end));
  503. //echo $dow3;
  504. //echo chr(10);
  505.  
  506. $thetext="low data=";
  507. $endtext=chr(34)."/>";
  508. $start= strpos($value, $thetext);
  509. $tmptext = substr($value,$start+strlen($thetext)+1);
  510. $end=strpos($tmptext, $endtext);
  511. $low3 = substr($tmptext,0,$end);
  512. //echo $low3;
  513. //echo chr(10);
  514.  
  515. $thetext="high data=";
  516. $endtext=chr(34)."/>";
  517. $start= strpos($value, $thetext);
  518. $tmptext = substr($value,$start+strlen($thetext)+1);
  519. $end=strpos($tmptext, $endtext);
  520. $high3 = substr($tmptext,0,$end);
  521. //echo $high3;
  522. //echo chr(10);
  523.  
  524. $thetext="condition data=";
  525. $endtext=chr(34)."/>";
  526. $start= strpos($value, $thetext);
  527. $tmptext = substr($value,$start+strlen($thetext)+1);
  528. $end=strpos($tmptext, $endtext);
  529. $cond3 = substr($tmptext,0,$end);
  530. //echo $cond3;
  531. //echo chr(10);
  532.  
  533. $forecast="Here's the three day forecast. $dow1: $cond1 with a Low temperature of $low1 degrees and expected high of $high1 degrees fahrenheit. ";
  534. $forecast=$forecast . "$dow2: $cond2 with a Low temperature of $low2 degrees and expected high of $high2 degrees. ";
  535. $forecast=$forecast . "$dow3: $cond3 with a Low temperature of $low3 degrees and expected high of $high3 degrees. Thank you for calling. Good bye.";
  536.  
  537. $msg= chr(34).$location.$temperature.$humidity.$wind.$conditions.$forecast.chr(34);
  538. $msg = str_replace( ",", " ", $msg );
  539.  
  540. if ($debug) :
  541. fputs($stdlog, "Forecast: " . $msg . "\n" );
  542. endif ;
  543.  
  544. execute_agi("SET VARIABLE WEATHER $msg");
  545.  
  546. //echo $msg;
  547. //echo chr(10);
  548. //echo chr(10);
  549.  
  550. if ($emaildebuglog) :
  551. system("mime-construct --to $email --subject " . chr(34) . "Nerd Vittles ZIP Weather ver. 5.0 Session Log" . chr(34) . " --attachment $log --type text/plain --file $log") ;
  552. endif ;
  553.  
  554. // clean up file handlers etc.
  555. fclose($stdin);
  556. fclose($stdout);
  557. fclose($stdlog);
  558. exit;
  559.  
  560. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement