cloudy cloudy

Author Topic: NWS Public Alert Messenger PHP Script  (Read 80328 times)

0 Members and 1 Guest are viewing this topic.

abaldish

  • Guest
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #30 on: July 12, 2009, 04:36:16 AM »
My luck sheesh! let me grab 1.07 lol

Version: 1.06 - 10-Jul-2009

What version is doing that double zone title? I thought I fixed that in version 1.07

abaldish

  • Guest
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #31 on: July 12, 2009, 04:41:28 AM »
Ok 1.07 is up there now!

Offline albanyweather

  • Posts: 7
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #32 on: July 12, 2009, 05:29:16 PM »
I'm not sure why but I cannot get it to work entirely correctly.

Of course, there's nothing for weather now to give you an example but let me try to describe.

Yesterday for example, it was saying for the em the initial special weather advisory but would not have any other details.  Ie:

Subject:
Message Body:
"Alert: Special Weather Statement"

Any thoughts?  The advisory text only had "Special Weather Statement" and the rss file had all the info.  My goal is to have a twitter with the advisory and pertinent advisory info

Cheers and thanks!
Mike

Offline MCHALLIS

  • Posts: 2,158
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #33 on: July 12, 2009, 09:07:09 PM »
The script only alerts about the advisory title, it does not display the contents of the alert.
Twitters cannot be more than 140 characters. If I tried to parse the contents of the "Special Weather Statement", it would not fit in a twitter anyway.

For this reason, my twitters have a URL on them, if they click on the URL they can see the full alert on my web site.
http://twitter.com/642weather

That is one of the drawbacks of twitter. The messages are so short  #-o

I had a twitter alert this morning (there was a local thunderstorm):
NWS issued: Short Term Forecast for South Washington Coast (Washington) #fb #funbeach #weather http://642weather.com

If you need short URLs for the twitter message, you can use tinyurl.com or http://bit.ly/
« Last Edit: July 12, 2009, 09:08:53 PM by MCHALLIS »

Offline ThorntonWeather

  • Tony
  • Commercial
  • Posts: 507
  • Thornton, CO USA
    • ThorntonWeather.com
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #34 on: July 13, 2009, 01:26:34 AM »
I installed this without a problem - a fine piece of work as always from Mike!

One little thing I noticed...  A short term forecast was issued around 3:00pm MDT in the Denver area (COZ040).  This was replaced with a new short term forcast at 6:47pm MDT.  The script did not send out the updated short term forecast instead saying "resend timer prevention timer is in effect" in the cron log the next time it was processed. 

I am guessing this is because they both had the same title?  Just want to check and make sure all is well as it should be.

Thank you as always for your work!

   Tony

Offline MCHALLIS

  • Posts: 2,158
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #35 on: July 13, 2009, 01:30:49 AM »
That is working the way I designed it Tony. If the alert title is the same, it will not resend unless the resend timer is enabled and timed out.

Message Sending Activity: (No messages sent because the advisory status did not change since the last time it was checked)

Offline MCHALLIS

  • Posts: 2,158
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #36 on: July 13, 2009, 01:38:43 AM »
Is anybody interested in a log file feature for this script?
It could append to a log file every time there is an alert.
You could include the log file in a Advisory History page.

I was thinking something like this:
<time-stamp> <advisory-title>
<time-stamp> <advisory-ended>
<time-stamp> <advisory-title>
<time-stamp> <advisory-ended>
<time-stamp> <advisory-title>
<time-stamp> <advisory-ended>

Offline Objector

  • Posts: 383
  • Dalton, Georgia, USA
    • Dalton Georgia Weather
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #37 on: July 13, 2009, 06:28:19 AM »
Mike,

I think a log would be really cool. Would it be a running log that showed the last "X" number of alerts or something like all alerts for a week, or month, etc. and was self maintaining?

Derek

Offline MCHALLIS

  • Posts: 2,158
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #38 on: July 13, 2009, 06:45:14 AM »
It should be self maintaining or the log would grow continuously.
Maybe it could auto purge oldest alerts after x amount of alerts are built up.
The x amount of alerts to store could be a setting that can be changed.
Also the logging feature can be enabled or disabled with a setting.

Does this sound good?
I might not do this for a few days, I have programmed so many hours this week I feel tired.
Right now, I am working on two computers at once, and writing a seminar: Internet and Computer Safety - "How to stay clear of viruses, adware, spyware, spam, and scams when using the Internet".
« Last Edit: July 13, 2009, 06:47:22 AM by MCHALLIS »

Offline ThorntonWeather

  • Tony
  • Commercial
  • Posts: 507
  • Thornton, CO USA
    • ThorntonWeather.com
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #39 on: July 13, 2009, 12:31:29 PM »
That is working the way I designed it Tony. If the alert title is the same, it will not resend unless the resend timer is enabled and timed out.

Got it - thanks, Mike.  I figured as much.  I will just adjust the timing in the script accordingly as our local NWS oftentimes sends out three or four short term forecasts in a row, each spanning a couple of hours.

As for a log file, that might be kind of nice.  Ideally it would be like you say where it gets overwritten after a period of time.

   T

Offline Objector

  • Posts: 383
  • Dalton, Georgia, USA
    • Dalton Georgia Weather
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #40 on: July 14, 2009, 03:43:31 AM »
Mike,

I think all that sounds great.

I don't doubt you're tired, with what you've done here over the last few days alone, not to mention all the other stuff you're doing. We all really appreciate everything but for sure you should take a break!!!!

Derek

abaldish

  • Guest
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #41 on: July 14, 2009, 03:47:49 AM »
Here is a good question!

Using the script i took notice that if you are with a hosting company with the emails going out it never goes out with the correct email information. Sample say you place in the script $email_address_sent_from = 'you@yourdomain.com';

So when the message comes down it shows it is from nick@hosting.com
Now they had me edit my php.ini files to have this:
sendmail_path = /usr/sbin/sendmail -t -i -f you@yourdomain.com;

And it still with go back to nick@hosting.com. Now one thing they said that would correct that problem is if the script used SMTP Authentication This way the email that is generated by the script would have the correct sent from email address as in you@yourdomain.com.

Is there an easy way of adding that?


Offline MCHALLIS

  • Posts: 2,158
  • Long Beach, WA USA
    • Weather for Long Beach, WA USA
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #42 on: July 14, 2009, 04:33:07 AM »
Here is a good question!

Using the script i took notice that if you are with a hosting company with the emails going out it never goes out with the correct email information. Sample say you place in the script $email_address_sent_from = 'you@yourdomain.com';

So when the message comes down it shows it is from nick@hosting.com
Now they had me edit my php.ini files to have this:
sendmail_path = /usr/sbin/sendmail -t -i -f you@yourdomain.com;

And it still with go back to nick@hosting.com. Now one thing they said that would correct that problem is if the script used SMTP Authentication This way the email that is generated by the script would have the correct sent from email address as in you@yourdomain.com.

Is there an easy way of adding that?


What host is causing all this trouble? is it windows or Linux?

First, just try this code in the settings section of the script after the $email_address_sent_from:
Code: [Select]
ini_set('sendmail_from', $email_address_sent_from); // needed for some windows servers
if that did not work, try adding this:

Code: [Select]
// OPTIONAL: You can change the default SMTP settings below...
// NOTE most servers do not need these settings changed!!!
$ctf_ini_set       = "yes";        // "yes" to enable this feature (ONLY if needed)
$ctf_smtp          = "localhost"; // sometimes mail.yourdomain.com Confirm with your host
$ctf_smtp_port     = "25";        // Confirm with your host
$ctf_smtp_username = "you";       // your mail username. If you do not know, ask your host
$ctf_smtp_password = "123456";    // your mail password. If you do not know, ask your host
$ctf_sendmail_from = "you@yourdomain.com";   // Your email
$ctf_sendmail_path = "/usr/sbin/sendmail -t -i"; // If different, ask host


if(strtolower($ctf_ini_set) == "yes") {
       ini_set("SMTP", $ctf_smtp);
       ini_set("smtp_port", $ctf_smtp_port);
       ini_set("smtp_password", $ctf_smtp_password);
       ini_set("smtp_username", $ctf_smtp_username);
       ini_set("sendmail_from", $ctf_sendmail_from);
       ini_set("sendmail_path", $ctf_sendmail_path);
}
    
 

let me know if it worked.


abaldish

  • Guest
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #43 on: July 14, 2009, 04:35:30 AM »
they are all Linux box's. going to try this one in this location in the script:
<?php
error_reporting(E_ALL ^ E_NOTICE); // Report all errors except E_NOTICE warnings
ini_set('display_errors', 1); // turn error reporting on
//ini_set('log_errors', 1); // log errors
//ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); // where to log errors
/*
NOAA Top Weather Advisory Alerter PHP Script by Mike Challis
More Info        - www.642weather.com/weather/scripts-noaa-top-weather-alerter.php
Download         - www.642weather.com/weather/scripts/noaa-top-weather-alerter.zip
Live Demo        - www.642weather.com/weather/rss-weather-alerter.php
Free PHP Scripts - www.642weather.com/weather/scripts.php
Contact Mike     - www.642weather.com/weather/contact_us.php
Donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2319642

// Mail Settings

// OPTIONAL: You can change the default SMTP settings below...
// NOTE most servers do not need these settings changed!!!
$ctf_ini_set       = "yes";        // "yes" to enable this feature (ONLY if needed)
$ctf_smtp          = "localhost"; // sometimes mail.yourdomain.com Confirm with your host
$ctf_smtp_port     = "25";        // Confirm with your host
$ctf_smtp_username = "you";       // your mail username. If you do not know, ask your host
$ctf_smtp_password = "123456";    // your mail password. If you do not know, ask your host
$ctf_sendmail_from = "you@yourdomain.com";   // Your email
$ctf_sendmail_path = "/usr/sbin/sendmail -t -i"; // If different, ask host


if(strtolower($ctf_ini_set) == "yes") {
       ini_set("SMTP", $ctf_smtp);
       ini_set("smtp_port", $ctf_smtp_port);
       ini_set("smtp_password", $ctf_smtp_password);
       ini_set("smtp_username", $ctf_smtp_username);
       ini_set("sendmail_from", $ctf_sendmail_from);
       ini_set("sendmail_path", $ctf_sendmail_path);
}
« Last Edit: July 14, 2009, 04:38:50 AM by JtwnPaWeather »

abaldish

  • Guest
Re: NOAA Top Weather Advisory Alerter PHP Script
« Reply #44 on: July 14, 2009, 04:45:27 AM »
The above didn't work.