cloudy cloudy

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

0 Members and 1 Guest are viewing this topic.

Offline bigdog

  • Posts: 4
Re: NWS Public Alert Messenger PHP Script
« Reply #210 on: September 04, 2011, 09:21:45 PM »
bigdog,

There is a setting to disable the message:
// normally when the Advisory is canceled or expires, and the cache is updated,
// it sends out email/text alert stating "There are no active watches, warnings or advisories".
// disable this?
$disable_expired_message = false; // change to true to disable alert ended alert

Hi, thanks for making this available

I know about that setting that's not related to what I am doing, I display the content line from the rss-advisoryXXXX-.txt file in another page, wound up using a IF condition to display nothing when matched "There are no active watches, warnings or advisories" I would have rather done that within your script itself instead, that's what I was trying to do.

also any advice on just displaying the summery within a page?, I did find another weather multi zone script that does that but yours is 90% of exactly what I need with the email etc, so I'd rather just stay with yours, its a bit to complex for me pulling out just the summery part for inclusion in a page.
I am really new at this.

Thanks
Big Dog

Offline K3JAE

  • Posts: 1,015
  • CoCoRaHS: TN-CR-7; WxUngrd: KTNBRUCE2; CWOP: AT066
  • Carroll County, TN, USA
    • K3JAE's Weather Station
Re: NWS Public Alert Messenger PHP Script
« Reply #211 on: September 15, 2011, 08:30:48 AM »
Ok. Finally figured it out. I was replacing the ...
define('OAUTH_CONSUMER_KEY', ---------------------------
define('OAUTH_CONSUMER_SECRET', ------------------------
with the ...
$access_token = '-------------------------------------------------------
$access_token_secret = '---------------------------------------------------

Instead I needed to just insert the 2 $access_token lines to the globals.php script at the top above the OAUTH lines.

Glad to see someone else is having the issues as I with Tweeting.

I have both the $access_token = '---' and the $access_token_secret = '---' already in place on my pages... I am not sure what globals.php is as I do not have this file.  Can someone assist a bit more here how to get the conditions, warnings, forecast pages to Tweet please.


73's de K3JAE
John
K3JAE Weather Station

Offline wxmanajb

  • Posts: 1
  • OS/Browser:
  • Mac OS X 10.7.4
  • Safari 5.1.7
Re: NWS Public Alert Messenger PHP Script
« Reply #212 on: June 09, 2012, 03:17:39 PM »
Receiving the following error message with the NWS Public Alert Messenger PHP script (going to Twitter):

Twitter: { "error": "Read-only application cannot POST", "request": "\/1\/statuses\/update.json" }
A Twitter was sent:
TEST:NWS issued: There are no active watches, warnings or advisories #weather http://tinyurl.com/m32jh2
Twitter message length: 103

I changed the request settings in the OAuth tool to "POST" but still no luck.

What am I doing wrong?

-wxmanajb


Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,151
  • North Bend, WA
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • MS IE 9.0
    • North Bend Weather
Re: NWS Public Alert Messenger PHP Script
« Reply #213 on: August 16, 2012, 12:07:45 AM »
URL Change... In your rss-weather-alerter.php file

Change this..

Code: [Select]
$RSS_URL = 'http://alerts.weather.gov/cap/wwaatmget.php?x=';

To this..

Code: [Select]
$RSS_URL = 'http://alerts.weather.gov/cap/wa.php?x=';

And change the /wa.php part to your state abbreviations. Can find the list here.. http://alerts.weather.gov/
"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline ALITTLEweird1

  • Mark
  • Global Moderator
  • Posts: 5,151
  • North Bend, WA
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • MS IE 9.0
    • North Bend Weather
Re: NWS Public Alert Messenger PHP Script
« Reply #214 on: August 24, 2012, 10:23:25 PM »
UPDATE:

The URL has been changed to this..

Code: [Select]

$RSS_URL = 'http://alerts.weather.gov/cap/wwaatmget.php?x=WAZ505&y=1


Change the WAZ505 to your code. The codes can be found here..  http://alerts.weather.gov/
"Nature can do without man, but man cannot do without nature."

Davis VP2 + VP2 Solar + VP2 UV + Lightning Detector + Logitech Webcam

Offline tstorm

  • Posts: 378
  • Harpers Ferry, WV
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Firefox 18.0
    • Meadowbrook Farm Weather
Re: NWS Public Alert Messenger PHP Script
« Reply #215 on: January 25, 2013, 03:15:02 PM »
I see that a few post back that wxmanajb posted a problem about posting to twitter but I don't see a response.  I  get the following when running through  test mode.

Email: (test email setting is enabled in settings)
An email was sent:
Subject: TEST:Advisory
Message: NWS issued: TEST: High Wind Watch for Jefferson (West Virginia)
Email message length: 64

Twitter: { "request": "\/1\/statuses\/update.json", "error": "Read-only application cannot POST" }
A Twitter was sent:
TEST:NWS issued: Winter Weather Advisory #weather http://tinyurl.com/m32jh2
Twitter message length: 75

Thanks,

John
« Last Edit: January 26, 2013, 01:31:01 AM by tstorm »

Offline gainesvilletxwx

  • Posts: 1
  • OS/Browser:
  • Win NT 10.0
  • Chrome 46.0.2486.0
Re: NWS Public Alert Messenger PHP Script
« Reply #216 on: March 26, 2016, 03:54:20 PM »
I keep getting the following error when trying to post to twitter.  I have double and triple checked all of the OAUTH keys and information.
"Twitter: WARNING: Twitter message not sent (check twitter settings)"  I have added the $access_token and $access_token_secret information as well.
SSL port or firewall issue perhaps?  I have checked the api.twitter.com status page and it shows that they are not having issues with the update.json script.
Suggestions appreciated.  Thanks.
« Last Edit: March 26, 2016, 04:00:33 PM by gainesvilletxwx »

Offline DavenLC

  • Posts: 11
  • LC, TX
  • OS/Browser:
  • Win NT 10.0
  • Firefox 53.0
    • Community Web site
Re: NWS Public Alert Messenger PHP Script
« Reply #217 on: June 05, 2017, 10:35:46 PM »
Is there a way to get the Details in the Body of the Email?    Currently all I get is the "Title" .   I'd like to see Subject <alert> Title   AND Message Body <summary> for emails.

i.e.
Title:
Code: [Select]
<title>Flood Advisory</title>
Summary for Message Body:
Code: [Select]
<summary>The National Weather Service in League City has issued a * Flood Advisory for... Northeastern Galveston County in southeastern Texas... Southeastern Chambers County in southeastern Texas... * Until 700 AM CDT. * At 553 AM CDT, Doppler radar indicated heavy rain due to</summary>
« Last Edit: June 06, 2017, 10:54:08 AM by DavenLC »

Offline Gonzo1982

  • Posts: 1
  • OS/Browser:
  • Win NT 10.0
  • Chrome 65.0.3325.181
Re: NWS Public Alert Messenger PHP Script
« Reply #218 on: April 24, 2018, 06:28:24 PM »
Is it possible to get more details in the tweet?  Twitter has expanded the character count and it would be useful to tweet info more than just the event name.  Including more details like till when etc. would be useful. The point is to get info out fast, not have to click on a link to find out more details.

Also, line 81,
Code: [Select]
$RSS_URL = 'http://alerts.weather.gov/cap/wwaatmget.php?x='; needs to be updated to
Code: [Select]
$RSS_URL = 'https://alerts.weather.gov/cap/wwaatmget.php?x=';  The site is https only now.