예제 #1
0
//echo("length of fire=" . strlen($fire) . "<br/>"); DEBUG
//$fire = strip_tags($firew);  // remove the tags
//echo $fire; echo "<br/>";
$cwbb = "COUNTY-WIDE BURN BAN";
$i = stripos($fire, $cwbb);
if ($i == 0) {
    Bailout("could not find {$cwbb}");
}
$lifted = stripos($fire, "Lifted", $i);
$effective = stripos($fire, "Effective", $i);
if ($lifted > 0) {
    $firebb = '<a href="http://www.co.pierce.wa.us/index.aspx?NID=982" style="color:green;">No Outdoor Burn Ban</a>';
} elseif ($effective > 0) {
    $firebb = '<a href="http://www.co.pierce.wa.us/index.aspx?NID=982"style="color:red;font-weight:bold">County-wide Outdoor Burn Ban</a>';
} else {
    Bailout("County Burn Ban not = Lifted or Effective. Revise the script.");
}
// write to file
$msg = $airqual . "<br/>Fire Safety: " . $firebb;
$old = file_get_contents($burnbanfile);
if ($msg == $old) {
    return 0;
}
echo $msg;
file_put_contents($burnbanfile, $msg);
return 0;
////////////////////////////////////////////////////////////
// Bailout - send error message and delete file and exit
function Bailout($s)
{
    echo "Error: " . $s;
예제 #2
0
//v=position of value="xxxx"
if ($v == false) {
    Bailout("value not found");
}
//echo ("  v=$v " . substr($str, $v, 10));
// extract the value
$q = strpos($str, '"', $v + 7);
// q = position of closing quote
if ($v == false) {
    Bailout("no closing quote");
}
//echo ("  q=$q " . substr($str, $q, 10));  echo (" l = " . ($q-$v-7));
$bb = substr($str, $v + 7, $q - $v - 7);
// bb = burn ban value
if ($bb == "") {
    Bailout("bb=null");
}
// write it
$airqual = "Peninsula air quality: " . $bb;
// fire department. removed 8/19/16.
//$fire = "?";
//$str = file_get_contents($pcfdlink);
//if($str == "") file_get_contents($pcfdlink); // 1 retry
//if($str != "") {
//    $j = strpos($str, 'NO BURN BAN'); // j = position of 'NO BURN BAN'
//    if($j == false) $fire == "<strong>Burn Ban</strong>";
//    else $fire = "No Ban";
//}
// County burn bans 8/19/16.
// Extract the BURN BAN status after 'Current fire safety burn ban status
$fire = "?";