php Code
 
<?php
$Hscale = 235;
$Hinterval = 12;
$Mscale = 255;
$Minterval = 59;
$HumidScale = 80;
$HumidInterval = 100;
$TempScale = 80;
$TempInterval = 100;
$temperature = 0;
$readtemperature = -1;
$relative_humidity = 0;
$readrelative_humidity = -1;
//$url = 'http://www.weather.gov/data/current_obs/KMCI.xml';
//cronjob: 25 * * * *  wget http://www.weather.gov/data/current_obs/KMCI.xml -O /home/me/htdocs/KMCI.xml -q
//noaa only updates once an hour, so there is no point in pounding their servers
//$url = 'http://my.site.org/KMCI.xml';
$url = '/home/me/htdocs/KMCI.xml';
echo "!";
// open the file at the URL for reading:
$filePath = fopen ($url, "r");
// as long as you haven't reached the end of the file
while (!feof($filePath))
  {
  $line = fgets($filePath, 4096);
  if (strpos($line,'<temp_f>')) {
    if ($readtemperature == -1) {
      $temperature = substr($line , strpos($line,'>')+1, strpos($line,'</')-strpos($line,'>')-1) ;
      switch (True) {
      case $temperature < 0:
        echo "0~";
        break;
      case $temperature > $TempInterval:
        echo $TempScale."~";
        break;
      case $temperature < 100 && $temperature > 0:
        echo round($TempScale / $TempInterval * $temperature)."~";
        break;
      }
      $readtemperature = 1;
    }
  }
  if (strpos($line,'<relative_humidity>')) {
    if ($readrelative_humidity == -1) {
      $relative_humidity = substr($line , strpos($line,'>')+1, strpos($line,'</')-strpos($line,'>')-1) ;
      echo round($HumidScale / $HumidInterval * $relative_humidity)."~";
      $readrelative_humidity = 1;
    }
  }
}
// close the file at the URL, you're done:
fclose($filePath);
//If the values are not found we still need to send something.
if ($readrelative_humidity == -1) {
  echo "0~";
}
if ($readtemperature == -1) {
  echo "0~";
}
echo round($Hscale / $Hinterval * (date("g")))."~".round($Mscale / $Minterval * date("i"))."~";
//echo "80~80~235~255~";
echo "<br> Temp: $temperature" ;
echo "<br> Humidity: $relative_humidity" ;
echo "<br> Time: ". date("g").":".date("i");
?>