WXforum.net
Web Weather => Weather Website PHP/AJAX scripting => Topic started by: tmabell on October 31, 2017, 10:07:10 AM
-
Within the past few weeks Curly's WxStory script is not working for at least one local office. For site KIWX Northern Indiana the text is being retreived but the image is not. It still seems to work for the other sites I checked.
http://ww2.mymishawakaweather.com/wxstory_inc.php (http://ww2.mymishawakaweather.com/wxstory_inc.php)
The cache file:
<?php
$mainStory = array (
'Tab2FileL.png?150944' =>
array (
0 => 'One More Cold Day',
1 => 'The cloudy and cold weather will linger for 1 more day with a few showers near Lake Michigan. Warmer temperatures will arrive starting Wednesday, with above normal temperatures by Thursday and Friday. The warmer temperatures will bring increasing chances for showers, especially Thursday and Thursday night.',
2 => 'http://www.weather.gov/images/iwx/wxstory/Tab2FileL.png?1509444443',
3 => 'https://www.weather.gov/iwx/weatherstory',
4 => './wscache/wsimg_iwx_Tab2FileL.png?150944.443',
5 => '443',
6 => 'Tab2FileL.png?150944',
7 => 'iwx',
8 => 'Northern Indiana',
),
);
$altStory = array (
'Tab3FileL.png?150944' =>
array (
0 => 'Halloween Forecast',
1 => 'Trick or Treat Forecast: Bundle up as you go out later this afternoon and early evening as temperatures will start in the upper 30s to lower 40s at the start of trick or treating and end up in the middle 30s by the end. Wind should be on the lighter side, but will still make it feel like its 30 to 35 degrees.',
2 => 'http://www.weather.gov/images/iwx/wxstory/Tab3FileL.png?1509444443',
3 => 'https://www.weather.gov/iwx/weatherstory',
4 => './wscache/wsimg_iwx_Tab3FileL.png?150944.443',
5 => '443',
6 => 'Tab3FileL.png?150944',
7 => 'iwx',
8 => 'Northern Indiana',
),
);
$nfo = 'Northern Indiana';
$hdlnr = array (
0 => ' <td style="text-align: center; background-color:#F0F7FF; padding: 6px 0px 6px;"><a href="/wxstory_inc.php?i=iwx&ifn=Tab2FileL.png?150944" title="One More Cold Day" style="text-decoration: none; color: #0071BC; font-size: 1.3em;">One More Cold Day</a></td>',
1 => ' <td style="text-align: center; background-color:#F0F7FF; padding: 6px 0px 6px;"><a href="/wxstory_inc.php?i=iwx&ifn=Tab3FileL.png?150944" title="Halloween Forecast" style="text-decoration: none; color: #0071BC; font-size: 1.3em;">Halloween Forecast</a></td>',
);
?>
Debugging indicates that the image file is not found (404) yet manually entering the link into a browser displays the image just fine. I am out of ideas!
-
Wish I can help, but honestly, this is the first time I've seen this script. And I LOVE it! Can anyone provide the raw files? I can't seem to find a valid download link any more.
-
Eric799... PM sent!
-
For others wishing to have this script it is attached (with Curly's permission).
-
Thanks tmabell!
-
Love the script, but it won't work at Washington-Baltimore NWS office... :(
-
I don't think any of the Eastern Region WFO's use the Weather Story. I might be wrong.
-
Is the script supposed to pull the graphics as well?
http://www.bismarckweather.net/wxstory.php
If I go to the first link, I don't see any graphics. But then change the office to Bismarck North Dakota, I can see the graphics.
On my own site, I don't see the graphics no matter what.
-
I looked at the code and realized I needed a wscache folder. Once I put that there, the images came.
But what is supposed to be in the wsimages folder? Anything?
-
I am able to see the graphics on your site for the default KBIS office, all three (currently) images are there.
-
I've attached the contents of my wsimages folder.
-
Thanks!
-
I'm not sure but I think those images are used if you enable the map option in the settings of the script.
-
If Curly has given his permission to release the WxStory script into the wild, I have his May 20, 2017 final release (https://www.gwwilkins.org/wxstory.php) running on my site. It works!
The zip is attached. There is an option to use a 'dropdown' list rather than the map, which is fairly current although some sites shown as red or orange may now have the Weather Story.
-
He has and thank you Jerry!!
EDIT:
I'm using V2.25 which works with PHP 7.1 but exibits the KIWX bug. Sadly, V2.23 doesn't work on my site because of unnessary changes made to PHP 7.1 (which is what I'm using)
If you have time to take a look well, your help wolde be greatly appreciated.. as always!
-
He has and thank you Jerry!!
EDIT:
I'm using V2.25 which works with PHP 7.1 but exibits the KIWX bug. Sadly, V2.23 doesn't work on my site because of unnessary changes made to PHP 7.1 (which is what I'm using)
If you have time to take a look well, your help wolde be greatly appreciated.. as always!
Not fond here of these perpetual updates which keep breaking scripts! PHP 7.0 works just fine here (http://selincolnwx.info/wxstory.php). My original link is running PHP 5.4! What doesn't work for me under PHP 7.0 is 'whos-online (http://selincolnwx.info/whos-online-maps.php)'. If Ken True can't figure that one out, I'm sure it's beyond me.
-
I'm not sure what version of php I'm using. How do I tell?
I just created a page on my Saratoga website and it's working fine: http://www.m82a1.us/wxStory.php (http://www.m82a1.us/wxStory.php) - unfortunately no nearby weather stories for me.
I wonder why the eastern NWS stations don't have a weather story.
-
The issue is with php 7.1 and up. I agree which is why I mentioned "unnecessary changes" to PHP 7. When your version is run on my site with PHP7.1 a fatal error is encounterd:
[php7:warn] [pid 12300:tid 908] [client 192.168.10.156:63217] PHP Warning: fopen(./wscache/wsimg_iwx_Tab2FileL.png?150947.193): failed to open stream: Resource temporarily unavailable in C:\\www\\wxStory_inc.php on line 356, referer: https://mymishawakaweather.com/wxstory_inc.php?i=lot
[Tue Oct 31 19:56:48.754078 2017] [php7:warn] [pid 12300:tid 908] [client 192.168.10.156:63217] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\\www\\wxStory_inc.php on line 357, referer: https://mymishawakaweather.com/wxstory_inc.php?i=lot
[Tue Oct 31 19:56:48.754078 2017] [php7:warn] [pid 12300:tid 908] [client 192.168.10.156:63217] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in C:\\www\\wxStory_inc.php on line 358, referer: https://mymishawakaweather.com/wxstory_inc.php?i=lot
[Tue Oct 31 19:56:48.754078 2017] [php7:error] [pid 12300:tid 908] [client 192.168.10.156:63217] PHP Fatal error: Uncaught Error: Call to undefined function mb_detect_encoding() in C:\\www\\wxStory_inc.php:371\nStack trace:\n#0 {main}\n thrown in C:\\www\\wxStory_inc.php on line 371, referer: https://mymishawakaweather.com/wxstory_inc.php?i=lot
-
The last time i tried this script, it didn't work for Washington State.
-
I just checked on GoDaddy (my host) and I'm running 7.0. There's some changes enforcing some php scripting that needs to be looked at for 7.1. Above my paygrade unfortunately.
-
has anyone worked on this script yet? I see mine will not load the image anymore.
-
has anyone worked on this script yet? I see mine will not load the image anymore.
Noticed this as well earlier today but haven't had a chance to dig into it yet.
-
This problem first showed up a few months ago on one or two sites. Now the whole thing went belly up altogether. The thing I find odd is that the links used by the script are still good. Those images can be retrieved using a web browser or even an image caching script.
-
Oh good. I thought it was just me. Mine went down about 2 days ago as well.
-
Ok, finally had a few minutes to look at this and it is a simple fix it seems.
In the wxStory-inc.php script... scroll down not too far and you'll see a group of "preg_replace" like so...
$html = preg_replace('/°/', '°', $html); // change it to an entity
$html = preg_replace('/‘/', '\'', $html); // change stray character
$html = preg_replace('/<u>/', '', $html); // fix error
$html = preg_replace('/<\/u>/', '', $html); // fix error
$html = preg_replace('/<br>/', '<br />', $html); // fix error
Add these to that group...
$html = preg_replace("/\.png\?(.+?)/" , ".png " , $html); // cut off random numbering of png
$html = preg_replace("/\.jpg\?(.+?)/" , ".jpg " , $html); // cut off random numbering of jpg
and it should fix it. At least it did for me.
-
That fixed mine up as well.
-
Nice work! That seems to have restored it for most people but if you select North Webster (Indiana) then you get nothing. The images are there so I don't know what's up with that.
-
Nicely done! Even 'Northern Indiana' is showing up for me right now. It looks as though some WFO's have resorted to the '?timestamp' appended to the end of some graphics in order to thwart browser caching.
-
I also just noticed that some sites use .jpg for their images.
So add this line in the same place as well....
$html = preg_replace("/\.jpg\?(.+?)/" , ".jpg " , $html); // cut off random numbering of jpg
I've also added that to the code in my earlier post.
-
Ok, finally had a few minutes to look at this and it is a simple fix it seems.
In the wxStory-inc.php script... scroll down not too far and you'll see a group of "preg_replace" like so...
$html = preg_replace('/°/', '°', $html); // change it to an entity
$html = preg_replace('/‘/', '\'', $html); // change stray character
$html = preg_replace('/<u>/', '', $html); // fix error
$html = preg_replace('/<\/u>/', '', $html); // fix error
$html = preg_replace('/<br>/', '<br />', $html); // fix error
Add these to that group...
$html = preg_replace("/\.png\?(.+?)/" , ".png " , $html); // cut off random numbering of png
$html = preg_replace("/\.jpg\?(.+?)/" , ".jpg " , $html); // cut off random numbering of jpg
and it should fix it. At least it did for me.
Thank you. Mine is working great again!
-
I hope what I found helps someone eventually. I will say that I am not skilled enough in php to be able to explain why most every site worked but a few, even after the fixes by RRRICK8 but they didn't. ("Northern Indiana" is the one I was focused on.) I was able to prove that the image was being retrieved but that the script wasn't processing it. I learned that by replacing
$imgName = '';
with this
$imgName = array();
that the KIWX image suddenly began displaying correctly. Why other sites worked before I don't know but I'd like to learn about it. The wild card here is that I am using PHP 7.2. There are a number of changes that affect our scripts in that version.
-
Mine now working fine, images and all. Unfortunately Phoenix isn't posting the story right now but have a call in to the PSR manager to see if he'll get it going again.
Thanks to all.
-
On my site I've also updated the WS_map.png to reflect some of the WFO's that were indicated as seldom used are now using the Weather Story daily or almost daily. I've changed those that have it 3 days in a row at least that I've checked.
If you want to replace it, just download it here and then upload it to your directory where you have it in your script.
(http://vermilionweather.com/images/WS_map.png)
-
Ok, finally had a few minutes to look at this and it is a simple fix it seems.
In the wxStory-inc.php script... scroll down not too far and you'll see a group of "preg_replace" like so...
$html = preg_replace('/°/', '°', $html); // change it to an entity
$html = preg_replace('/‘/', '\'', $html); // change stray character
$html = preg_replace('/<u>/', '', $html); // fix error
$html = preg_replace('/<\/u>/', '', $html); // fix error
$html = preg_replace('/<br>/', '<br />', $html); // fix error
Any other ideas? This didn't work for me.... :(
Add these to that group...
$html = preg_replace("/\.png\?(.+?)/" , ".png " , $html); // cut off random numbering of png
$html = preg_replace("/\.jpg\?(.+?)/" , ".jpg " , $html); // cut off random numbering of jpg
and it should fix it. At least it did for me.
-
Looks like it's all working except the first radar tab.
That gif image adds another dimension to it.
Along with the .png and .jpg replace we need to add .gif to the mix.
So add gif to the solution....
$html = preg_replace("/\.png(.+?)/" , ".png " , $html); // cut off random numbering of png
$html = preg_replace("/\.jpg\?(.+?)/" , ".jpg " , $html); // cut off random numbering of jpg
$html = preg_replace("/\.gif\?(.+?)/" , ".gif " , $html); // cut off random numbering of gif
-
On my site I've also updated the WS_map.png to reflect some of the WFO's that were indicated as seldom used are now using the Weather Story daily or almost daily. I've changed those that have it 3 days in a row at least that I've checked.
If you want to replace it, just download it here and then upload it to your directory where you have it in your script.
(http://vermilionweather.com/images/WS_map.png)
As a side... I've notice the last few days (that I've been monitoring) that even the few remaining orange "Seldom Used" have been working except Boise. As of time of this posting, both Arizona sites, Medford OR., and Washington is working and has been for the most part the last few days. Portland (which is labeled red- not used) is even using theirs today. So I might be updating this map again in a few days.
[ You are not allowed to view attachments ]
-
Hi All,
Looks like this scrip will not work for me or folks in Alaska. Hawaii and Alaska are not included in the mix.
Looks good for the CONUS (Lower 48) though.
Maybe one day we will be included.
Regards,
--Stan Y.
Maui, Hawaii
-
Hi All,
Looks like this scrip will not work for me or folks in Alaska. Hawaii and Alaska are not included in the mix.
Looks good for the CONUS (Lower 48) though.
Maybe one day we will be included.
Regards,
--Stan Y.
Maui, Hawaii
Yeah, I don't see a Weather Story on any of the WFO's for those areas.
-
Warning: imagecreatefrompng(): './images/WS_map.png' is not a valid PNG file in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 279
Warning: getimagesize(): PNG file corrupted by ASCII conversion in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 280
Warning: imagecolorallocate() expects parameter 1 to be resource, boolean given in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 281
Warning: imagecolortransparent() expects parameter 1 to be resource, boolean given in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 282
Warning: imagecreatetruecolor(): Invalid image dimensions in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 283
Warning: imagecreatefrompng(./images/ind.png): failed to open stream: No such file or directory in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 284
Warning: imagecopymerge() expects parameter 1 to be resource, boolean given in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 285
Warning: imagedestroy() expects parameter 1 to be resource, boolean given in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 286
Warning: imagepng() expects parameter 1 to be resource, boolean given in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 287
Warning: imagedestroy() expects parameter 1 to be resource, boolean given in /home/hj2ke8lfpx43/public_html/wxStory_inc.php on line 288
not sure what i did wrong i just changed
// MAP & DATA SETTINGS
$useWFOmap = true; // true=use map to select WFO false=use drop down menu to select the WFO
$ws_mapfolder = './images/'; // main map image file FOLDER
$ws_cachefolder = './wscache/'; // cache file FOLDER
$wfomaps = './images/'; // folder containing individual WFO coverage maps
$mapname = 'WS_map'; // main map name - without extension
$ift = '.png'; // map image file extesion
$autocacheclean = true; // true=auto delete cache files older than 1 day false=keep cache files
-
So what did you change there?
Only thing I see different than mine is the $wfomaps folder location.
Mine is $wfomaps = './wsimages/';
-
So what did you change there?
Only thing I see different than mine is the $wfomaps folder location.
Mine is $wfomaps = './wsimages/';
was there a zip for wxstory cuz i dont have wsimages?
-
So what did you change? You said you changed that section.
-
So what did you change? You said you changed that section.
Just False to true on $useWFOmap = true; // true=use map to select WFO false=use drop down menu to select the WFO
-
Change it back to false to see if your errors go away.
I suspect that you didn't upload the WFOmaps folder or it's in a different location.
-
Change it back to false to see if your errors go away.
I suspect that you didn't upload the WFOmaps folder or it's in a different location.
There was never a WFOmaps folder where do i get one at? I changed it back and i had no errors.
-
Here is the original zip I have. Don't know for sure if this is the one that Curly released because I was doing some beta testing for him on a few scripts and I believe this was one of them.
If you do a complete new reload, make sure to add the preg_replace changes posted earlier...
[ You are not allowed to view attachments ]
-
Here is the original zip I have. Don't know for sure if this is the one that Curly released because I was doing some beta testing for him on a few scripts and I believe this was one of them.
If you do a complete new reload, make sure to add the preg_replace changes posted earlier...
[ You are not allowed to view attachments ]
Ok thanks :)
-
This is crazy I still get the errors lol
-
This is crazy I still get the errors lol
Did you upload everything like the Readme file instructed?
-
Yep im wondering if its because of PHP 7
-
You can hide the errors by commenting out the error reporting function at the top of the script.
When I looked earlier on your site, your current weather story was showing but the map wasn't. You need to get that part working first if you want to use the map. You need to set the settings correctly to point to where you added the WFOmaps
-
You can hide the errors by commenting out the error reporting function at the top of the script.
When I looked earlier on your site, your current weather story was showing but the map wasn't. You need to get that part working first if you want to use the map. You need to set the settings correctly to point to where you added the WFOmaps
Now the .png doesnt want to load http://gosportwx.com/wxstory.php
-
You can hide the errors by commenting out the error reporting function at the top of the script.
When I looked earlier on your site, your current weather story was showing but the map wasn't. You need to get that part working first if you want to use the map. You need to set the settings correctly to point to where you added the WFOmaps
Now the .png doesnt want to load http://gosportwx.com/wxstory.php
Did you add the preg_replace codes from above? The .png is showing in your "View Source" but it still has the random numbers atteached.
-
Ya I fixed that part now. Want to use the map it looks cool
-
Ok, I see you have the image back now need to get the map working.
Your view source shows that you are calling for it in here... ./cache/WS_mapind.png
Did you upload the WFOmaps into that cache folder or into a different folder? They are the ones that are in the wsimages folder
-
Ok, I see you have the image back now need to get the map working.
Your view source shows that you are calling for it in here... ./cache/WS_mapind.png
Did you upload the WFOmaps into that cache folder or into a different folder? They are the ones that are in the wsimages folder
wsimages
-
Ok, I see you have the image back now need to get the map working.
Your view source shows that you are calling for it in here... ./cache/WS_mapind.png
Did you upload the WFOmaps into that cache folder or into a different folder? They are the ones that are in the wsimages folder
wsimages
So you need to change the settings to reflect where you uploaded them to.... $wfomaps = './wsimages/'; // folder containing individual WFO coverage maps
You also need to upload the WS_map that was in the zip to your images folder.
-
Ok I done that.
-
Ok I done that.
Did both? WS_map into images folder and uploaded complete wximages folder onto your server?
If so, can you post your setting from the script like you did earlier so I can see them?
-
Below is attached my wxStory_inc.php in a txt file
Mike
-
This is my Map Settings from the script...
// MAP & DATA SETTINGS
$useWFOmap = true; // true=use map to select WFO false=use drop down menu to select the WFO
$ws_mapfolder = './images/'; // main map image file FOLDER WS_map.png goes into "images" folder;
$ws_cachefolder = './wscache/'; // cache file FOLDER
$wfomaps = './wsimages/'; // folder containing individual WFO coverage maps Upload entire wsimages folder onto your server
$mapname = 'WS_map'; // main map name - without extension
$ift = '.png'; // map image file extension
$autocacheclean = true; // true=auto delete cache files older than 1 day false=keep cache files
-
This is my Map Settings from the script...
// MAP & DATA SETTINGS
$useWFOmap = true; // true=use map to select WFO false=use drop down menu to select the WFO
$ws_mapfolder = './images/'; // main map image file FOLDER WS_map.png goes into "images" folder;
$ws_cachefolder = './wscache/'; // cache file FOLDER
$wfomaps = './wsimages/'; // folder containing individual WFO coverage maps Upload entire wsimages folder onto your server
$mapname = 'WS_map'; // main map name - without extension
$ift = '.png'; // map image file extension
$autocacheclean = true; // true=auto delete cache files older than 1 day false=keep cache files
yep mine looks like that except i use /cache instead of /wscache ... idk why its not generating like it should..
-
http://gosportwx.com/images/WS_map.png (http://gosportwx.com/images/WS_map.png) why is it like this?
-
Try the new updated WS_map.png I posted here earlier.
Download it then upload to your server in the images folder overwriting the current one.
(http://vermilionweather.com/images/WS_map.png)
-
Try the new updated WS_map.png I posted here earlier.
Download it then upload to your server in the images folder overwriting the current one.
(http://vermilionweather.com/images/WS_map.png)
That's what I used. I just went back to the original style i had with the drop down menu.. I tried everything :(
-
Ok. Just seems like it's an issue that it can't get the WS_map.png
-
Ok. Just seems like it's an issue that it can't get the WS_map.png
Maybe Ken can chime in on this once he is back on *shrugs*
-
Mike,
I've seen this error before and it was caused by an image being uploaded in ASCII mode instead of Binary mode. Make sure first you can view the image correctly on your machine after you've downloaded it from the forum. If that works, ensure you're FTPing correctly to your host.
Steve
-
Mike,
I've seen this error before and it was caused by an image being uploaded in ASCII mode instead of Binary mode. Make sure first you can view the image correctly on your machine after you've downloaded it from the forum. If that works, ensure you're FTPing correctly to your host.
Steve
That was what i was about to do i was using FileZilla and switched to CoreFTP and it fixed it now to figure why the cache isnt wanting to update and process the image files...
http://gosportwx.com/wxstory.php?i=lsx (http://gosportwx.com/wxstory.php?i=lsx)
-
What version of php is your host using?
-
What version of php is your host using?
7.1
-
You may want to review my earlier mention of a change I made to restore functionality when using php 7.1 + up. However, My version of the script is not displaying the St. Louis images either. rrrick8, is that site showing an image? Jerry's site isn't working for LSX either. Right now I'm stumped.
-
You may want to review my earlier mention of a change I made to restore functionality when using php 7.1 + up. However, My version of the script is not displaying the St. Louis images either. rrrick8, is that site showing an image? Jerry's site isn't working for LSX either. Right now I'm stumped.
Looking at the lsx issue.... there is a ? in their time stamp/number after the image. Removing that fixed it for me.
So, we add the following to the preg_replace grouping and watch to see if it adversely effects the script in other ways.
$html = preg_replace("/\?/" , " " , $html); // cut out ?
-
You may want to review my earlier mention of a change I made to restore functionality when using php 7.1 + up. However, My version of the script is not displaying the St. Louis images either. rrrick8, is that site showing an image? Jerry's site isn't working for LSX either. Right now I'm stumped.
Looking at the lsx issue.... there is a ? in their time stamp/number after the image. Removing that fixed it for me.
So, we add the following to the preg_replace grouping and watch to see if it adversely effects the script in other ways.
$html = preg_replace("/\?/" , " " , $html); // cut out ?
Thanks Rick that fixed it :)
-
Rick, another map change, please. psr (Phoenix) needs to be green. Had a chat with the manager here and he indicates they are now supporting Story. I have it up at http://tiggrweather.net/wxstory.php.
Thanks.
-
Rick, another map change, please. psr (Phoenix) needs to be green. Had a chat with the manager here and he indicates they are now supporting Story. I have it up at http://tiggrweather.net/wxstory.php.
Thanks.
I'm not seeing any pic of the story?
-
Rick, another map change, please. psr (Phoenix) needs to be green. Had a chat with the manager here and he indicates they are now supporting Story. I have it up at http://tiggrweather.net/wxstory.php.
Thanks.
Yes, I've been monitoring those out west and Boise seems to be the only one not having a Weather Story virtually every day.
I'll get the map changed later today hopefully.
I'm not seeing any pic of the story?
Probably just timing. At time of your posting it is only 3-something AM out there so they just haven't posted it yet and the last one had expired.
They've had one daily that I've seen.
-
There seems to be an issue displaying the Weather Story page out of Shreveport, LA this morning. On the initial display, 5 tabs are shown below the map. However, nothing is shown for the first one - SHV Radar. All the other ones work. However, when I go to the actual NWS page at http://www.weather.gov/shv/, there is radar showing on that first tab.
Any ideas?
Thanks,
Steve
-
I'm not seeing any pic of the story?
Weird. It was there late last night. I've seen 2 different pics in the past 2 days.
-
Hmm - might be me (drat) or possibly the pic was coded wrong. There are numerous Freeze and Hard Freeze Warnings out (http://tiggrweather.net/wxadvisory.php) that don't expire until 0900 today but am not seeing them on http://tiggrweather.net/ where they should be. Most recent pics have shown data corresponding to these warnings.
-
Alerts are back on my home page where they should be. The only thing I see on the story page is a header-like banner with 'Cold Weather' in it right below the map. Apparently a "pic"??
-
Rick, another map change, please. psr (Phoenix) needs to be green. Had a chat with the manager here and he indicates they are now supporting Story. I have it up at http://tiggrweather.net/wxstory.php.
Thanks.
Yes, I've been monitoring those out west and Boise seems to be the only one not having a Weather Story virtually every day.
I'll get the map changed later today hopefully.
I'm not seeing any pic of the story?
Probably just timing. At time of your posting it is only 3-something AM out there so they just haven't posted it yet and the last one had expired.
They've had one daily that I've seen.
http://gosportwx.com/wxstory.php?i=psr (http://gosportwx.com/wxstory.php?i=psr)
On my website I get this "Today's Weather Story has not been posted for Phoenix"
-
Not seeing that on mine, Mike. Only the banner mentioned above.
-
On my website I get this "Today's Weather Story has not been posted for Phoenix"
When I go to that Phoenix link, below that map it says "Phoenix does not have the Weather Story".
Steve
-
+1
-
Turns out the 'Cold Weather' banner just below the US map is actually a link. Clicking on it brings up the Story image. Not the way I would do it, but...
-
There seems to be an issue displaying the Weather Story page out of Shreveport, LA this morning. On the initial display, 5 tabs are shown below the map. However, nothing is shown for the first one - SHV Radar. All the other ones work. However, when I go to the actual NWS page at http://www.weather.gov/shv/, there is radar showing on that first tab.
Any ideas?
Thanks,
Steve
I'd say you probably missed the post earlier about adding gif to the preg -replace list. That radar runs a gif image.
Here is the complete list to include getting rid of the ? that was hanging up some images.
// fix characters
$html = preg_replace('/°/', '°', $html); // change it to an entity
$html = preg_replace('/‘/', '\'', $html); // change stray character
$html = preg_replace('/<u>/', '', $html); // fix error
$html = preg_replace('/<\/u>/', '', $html); // fix error
$html = preg_replace('/<br>/', '<br />', $html); // fix error
$html = preg_replace("/\.png\?(.+?)/" , ".png " , $html); // cut off random numbering of png
$html = preg_replace("/\.png(.+?)/" , ".png " , $html); // cut off random numbering of png
$html = preg_replace("/\.jpg\?(.+?)/" , ".jpg " , $html); // cut off random numbering of jpg
$html = preg_replace("/\.gif\?(.+?)/" , ".gif " , $html); // cut off random numbering of gif
$html = preg_replace("/\?/" , " " , $html); // cut off ?
-
I'd say you probably missed the post earlier about adding gif to the preg -replace list. That radar runs a gif image.
Here is the complete list to include getting rid of the ? that was hanging up some images.
Rick,
I had seen that post and "thought" I had updated the script, but obviously I hadn't. Sorry for the bother. It's working great now.
Thanks,
Steve
-
I'd say you probably missed the post earlier about adding gif to the preg -replace list. That radar runs a gif image.
Here is the complete list to include getting rid of the ? that was hanging up some images.
Rick,
I had seen that post and "thought" I had updated the script, but obviously I hadn't. Sorry for the bother. It's working great now.
Thanks,
Steve
No problem. Glad you got it working.
-
I went ahead and updated the WS_map.png showing everything in the west as green with the exception of Boise.
Both Phoenix and Tucson haven't had theirs active the last couple of days but they were for numerous days prior to this. So they may still be spotty but with John saying they are going to be having it, I went ahead and updated those as well to green status.
Hopefully we have all the images extension problems ironed out.
(http://vermilionweather.com/images/WS_map.png)
-
I have to play Dumbo again. Where are you hiding the download link? The message where you originally had it - http://www.wxforum.net/index.php?topic=33102.msg338505#msg338505 - no longer shows it, and unless I've gone blind too I can't find it.
Thanks, and also for updating the map. True to form PSR is not showing a story for today.
-
I have a challenging thought. If one wished to display both the map and the story in a side-by-side manner, how hard would that be? I imagine in addition to rearranging them, some re-sizing might be needed as well. Is this goal too lofty?
-
I have to play Dumbo again. Where are you hiding the download link? The message where you originally had it - http://www.wxforum.net/index.php?topic=33102.msg338505#msg338505 - no longer shows it, and unless I've gone blind too I can't find it.
Thanks, and also for updating the map. True to form PSR is not showing a story for today.
Should just be able to right click image and save it as WS_map.png then upload to your server. I didn't add a link.
-
Kind of weird that Melbourne, FL is the only site in that state that does not have a daily weather story but yet they do something similar to it daily called an Impact Weather Update or Graphicast. You can see it here.... http://www.weather.gov/mlb/blog (http://www.weather.gov/mlb/blog)
Wish they'd just do it like all the others then we could add it to the mix.
-
PSR is working again, along with station and official record high temps at my site (28 Dec). Nice. Hopefully they'll keep at the story.
-
PSR is working again, along with station and official record high temps at my site (28 Dec). Nice. Hopefully they'll keep at the story.
Yeah, I think they activated it just to show off the temps while the rest of the country is freezing. :evil:
Seriously though, since I changed the map, they haven't had it active but a couple of times. Hopefully the frequency increases.
I've notice a few of the western sites haven't been posting during the holidays here as much as they did before. I'll just blame it on skeleton crew manning until after the New Year.
-
Even Boise has one active now. First time I've seen theirs active in ages.
-
Definitely a mess in most of the rest of the country. It was running here for at least 3 days before I posted about it, then it stopped, now it's back. Hopefully they will keep their word.
-
Have been reading this thread and decided to give wxstory a try. So, far, I have been able to get it to run decently however, I am having issues with both width and vertical sizing. I am using a standard Saratoga template. Some selections show a very wide and long area while others work as I think they should. I have looked at a couple other websites using the same code and they don't exhibit the same behavior I am seeing.
I've placed the link to my wxstory.php in my NWS Forecast & Advisories menu. The wxstory.php link is at the bottom of the forecast flyout menu item. Reno is my default and its width seems to be okay.
-
Unable to see any problems now as it shows, "Today's Weather Story has not been posted for Reno". Reno shows the same from my site. Would help if you could list some of the other cities you indicate are causing problems for you.
-
Don, I ran just your wxStory_inc.php without the template and everything was normal on 15 sites I tested.
Your problem is use withing the template, which I don't use so can't help you with that.
Again, though... it appears your WxStory is running fine.
-
John, rrrick8,
I have attached two screen captures showing what I am seeing for both Reno and Grand Junction, CO. I see many other sites with similar results. For some reason, some of the sites display in a very wide format.
-
Like I said above... if you run just the script wxStory_inc.php it all looks good.
So I believe the script is fine it's just something askew with your placement in the template which I don't use so I can't help you on that one.
-
Don, as Rick said it seems not to be in Curly's script. I ran my site script and selected Reno and it looks just fine (attached). I was unable to find the problem as well. Sorry.
-
John, rrrick8,
I have attached two screen captures showing what I am seeing for both Reno and Grand Junction, CO. I see many other sites with similar results. For some reason, some of the sites display in a very wide format.
Your http://www.carsonvalleyweather.com/wxStory_inc.php is fine. All html is clear and correct for all cities, without or with text..
But your wxstory.php has an extra line of code <!-- end of menubar -->
<div id="main-copy">
<pre>
<table border="0" cellspacing="0" cellpadding="0" style="width: 700px; margin: 20px auto 0px auto;">
<tr>
<td style="text-align:center;"><a href="http://www.weather.gov/rev/" onclick="window.open(this.href,'_blank');return false;" title="Click to view this forecast office" style="text-decoration: none; color: inherit;"><span style="font-size:20px; letter-spacing:2px;"><b><span style="color:#0061AC;">WEATHER STORY</span><br />Reno<br /><span style="font-size:60%; vertical-align: text-top;">Weather Forecast Office</span></b></span></a></td>
</tr>
</table>
You should find that '<pre>' and remove it. That will take care of the very wide page, which only occurs when there is text below the map. That text will be as wide as the longest line, because of that '<pre>'. You can see that all bottom text is displayed in a monospaced courier font and without line-breaks.
We can not check your php script online, so if you can not find that <pre> , post the script here with the .txt extension.
Wim
-
John, rrrick8,
I have attached two screen captures showing what I am seeing for both Reno and Grand Junction, CO. I see many other sites with similar results. For some reason, some of the sites display in a very wide format.
Your http://www.carsonvalleyweather.com/wxStory_inc.php (http://www.carsonvalleyweather.com/wxStory_inc.php) is fine. All html is clear and correct for all cities, without or with text..
But your wxstory.php has an extra line of code <!-- end of menubar -->
<div id="main-copy">
<pre>
<table border="0" cellspacing="0" cellpadding="0" style="width: 700px; margin: 20px auto 0px auto;">
<tr>
<td style="text-align:center;"><a href="http://www.weather.gov/rev/" onclick="window.open(this.href,'_blank');return false;" title="Click to view this forecast office" style="text-decoration: none; color: inherit;"><span style="font-size:20px; letter-spacing:2px;"><b><span style="color:#0061AC;">WEATHER STORY</span><br />Reno<br /><span style="font-size:60%; vertical-align: text-top;">Weather Forecast Office</span></b></span></a></td>
</tr>
</table>
You should find that '<pre>' and remove it. That will take care of the very wide page, which only occurs when there is text below the map. That text will be as wide as the longest line, because of that '<pre>'. You can see that all bottom text is displayed in a monospaced courier font and without line-breaks.
We can not check your php script online, so if you can not find that <pre> , post the script here with the .txt extension.
Wim
Wim, you are a genius! =D> That was the problem. Since I was incorporating this code into my Saratoga template, I had simply taken the code and included the <pre>...</pre> in my wxstory.php and that is what was causing the issue with screen width.
Thank you very much for the assistance. I have included the code section from my wxstory.php that I am now using to include the wxStory_inc.php, for Saratoga template users.
<body>
<?php
############################################################################
include("header.php");
############################################################################
include("menubar.php");
############################################################################
?>
<div id="main-copy">
<?php include("wxStory_inc.php"); ?>
<><!-- end main-copy -->
<?php
############################################################################
include("footer.php");
############################################################################
# End of Page
############################################################################
?>
-
I think this script is another casualty of the changes made yesterday by the NWS. There are no images showing as of today. Any thoughts on what needs to be changed?
-
I just checked it this morning and it was working. Now it's not displaying the graphics.
Yecchhh! :-(
-
I'd try changing
(in_array($wswfo, $hpwxs)) ? $wxsurl = 'http://www.weather.gov/'.$wswfo.'/' : $wxsurl = 'http://www.weather.gov/'.$wswfo.'/weatherstory';
to (in_array($wswfo, $hpwxs)) ? $wxsurl = 'https://www.weather.gov/'.$wswfo.'/' : $wxsurl = 'https://www.weather.gov/'.$wswfo.'/weatherstory';
and make sure you have $useCURL = true; // true=get data by cURL method false=stream data
-
Thanks, but no joy, Ken. Still no images. I tried to place 'oax' in the https array, but that didn't work either.
Curly's code is more than a bit difficult for me to unwind. I've given it a shot but now I'm not even seeing new images show up in my '/wscache' directory.
-
Not every city displays graphics on a regular or daily basis. PSR is a good example. Yesterday there was info about a coming rainstorm and a large graphic to go along with it. Today it says, "Phoenix does not have the Weather Story." Well they do, but when they want. I pushed a lot of green buttons on the map today. Pretty much the same wording along with a lot of other text items below the map.
-
Thanks, but no joy, Ken. Still no images. I tried to place 'oax' in the https array, but that didn't work either.
Curly's code is more than a bit difficult for me to unwind. I've given it a shot but now I'm not even seeing new images show up in my '/wscache' directory.
none of mine are working either.. i applied the fix that ken suggested but nothing. http://www.gosportwx.com/wxstory.php?i=ind
-
Worked fine for me two days ago (2/27) but now all I get is the text with a broken image symbol displayed. Just when I need it most as we have the season's largest storm coming-in right now... ](*,)
-
It seems that the NWS used to accept query strings without a "?" such as http://www.weather.gov/images/arx/wxstory/Tab2FileL.png e73c9f3d342158b6aa283cb30e80054 but no longer does. Perhaps Ken and his regex wizardry will be able to come up with a better fix, but this seems to be doing it for me:
replace
function GetDataByCurl($url) {
global $noted; // set global
with
function GetDataByCurl($url) {
$url = str_replace("png ", "png?", $url); // added 3/1/18
global $noted; // set global
and
function getWSBystream($url) {
global $noted;
with
function getWSBystream($url) {
$url = str_replace("png ", "png?", $url); // added 3/1/18
global $noted;
- Jim
-
That update worked for me as well.
-
Thanks, Jim! \:D/ =D> \:D/ Works great!
-
Thanks, Jim! \:D/ =D> \:D/ Works great!
Jerry - I notice the map does not change when you select the various green dots. Once I select another location, it always shows the Pocatello, ID section of the map. The wx story and header do change with each different selection. Not sure if it's me or not. I've tried it on Chrome and Firefox and get similar results.
-
Thanks, Jim! \:D/ =D> \:D/ Works great!
Jerry - I notice the map does not change when you select the various green dots. Once I select another location, it always shows the Pocatello, ID section of the map. The wx story and header do change with each different selection. Not sure if it's me or not. I've tried it on Chrome and Firefox and get similar results.
I think it has to do with file permissions, but I haven't solved the problem yet.
-
Jim's update worked for me, except for the Reno sector. Others appear to be working just fine but not Reno, that still gives me the broken image icon... And, the map shows the correct selection so not sure what the issue is with Jerry's. It could be file permissions as he indicated.
-
I just tried Reno and it worked fine for me.
As for the overlays on the US map working, are you using wscache as your cache? I had to go to that to fix something, but I don't remember what the problem was when I did that. I used to be able to remember things.
- Jim
-
I just tried Reno and it worked fine for me.
As for the overlays on the US map working, are you using wscache as your cache? I had to go to that to fix something, but I don't remember what the problem was when I did that. I used to be able to remember things.
- Jim
The Reno image is working now. I don't know what "wscache" is...
-
The Reno image is working now. I don't know what "wscache" is...
Created by wxStory_inc.php - $ws_cachefolder = './wscache/'; Also $wfomaps = './wsimages/';
It's loaded with stuff!
-
The Reno image is working now. I don't know what "wscache" is...
Created by wxStory_inc.php - $ws_cachefolder = './wscache/'; Also $wfomaps = './wsimages/';
It's loaded with stuff!
Yes, I see them now. Both of them are loaded with files. I also have another folder named "wsmainimages". It has one file in it named WS_map.png. That same file is also located in the wsimages folder. They appear to be identical.
-
Yes, I see them now. Both of them are loaded with files. I also have another folder named "wsmainimages". It has one file in it named WS_map.png. That same file is also located in the wsimages folder. They appear to be identical.
Interesting - I don't have the "wsmainimages".
-
Yes, I see them now. Both of them are loaded with files. I also have another folder named "wsmainimages". It has one file in it named WS_map.png. That same file is also located in the wsimages folder. They appear to be identical.
Interesting - I don't have the "wsmainimages".
It's a mystery to me too. I suspect it might be a remnant of an earlier installation although all of the image files have a date of 1/6/2018 which is about the time I installed the Weather story routines. I don't have the original files I downloaded so can't go back to them to see if there was a sub-folder in them.
However, this brings up a question regarding the map of the US which shows the wfo's who participate in the weather story program. Who maintains this image file and how does it get updated when wfo's come on-line or drop-off the program?
-
However, this brings up a question regarding the map of the US which shows the wfo's who participate in the weather story program. Who maintains this image file and how does it get updated when wfo's come on-line or drop-off the program?
rrrick8 made the recent changes to it.
-
It seems that the NWS used to accept query strings without a "?" such as http://www.weather.gov/images/arx/wxstory/Tab2FileL.png e73c9f3d342158b6aa283cb30e80054 but no longer does. Perhaps Ken and his regex wizardry will be able to come up with a better fix, but this seems to be doing it for me:
replace
function GetDataByCurl($url) {
global $noted; // set global
with
function GetDataByCurl($url) {
$url = str_replace("png ", "png?", $url); // added 3/1/18
global $noted; // set global
and
function getWSBystream($url) {
global $noted;
with
function getWSBystream($url) {
$url = str_replace("png ", "png?", $url); // added 3/1/18
global $noted;
- Jim
Thanks Jim works great on my end!
-
Thanks, Jim! \:D/ =D> \:D/ Works great!
Jerry - I notice the map does not change when you select the various green dots. Once I select another location, it always shows the Pocatello, ID section of the map. The wx story and header do change with each different selection. Not sure if it's me or not. I've tried it on Chrome and Firefox and get similar results.
To buttress my idea that file permissions are the issue with the map not changing to a newly selected area, my alternate self-hosted test-site (http://selincolnwx.info/wxstory.php) has no such problems. I have granular control of file permissions there, whereas on my main GoDaddy-hosted site (https://www.gwwilkins.org/wxstory.php) I don't, and the permissions keep getting hosed when the files are re-written. All modified files in the GoDaddy /wscache revert to '604' from '707'. Anybody know how to keep this from happening?
-
Today I found that there are sites using .gif and .jpg files so we need another tweak. Now we should have
function GetDataByCurl($url) {
$url = str_replace("png ", "png?", $url); // added 3/1/18
$url = str_replace("jpg ", "jpg?", $url); // added 3/3/18 Shreveport uses .jpg
$url = str_replace("gif ", "gif?", $url); // added 3/3/18 Fort Worth use .gif
global $noted; // set global
and
function getWSBystream($url) {
$url = str_replace("png ", "png?", $url); // added 3/1/18
$url = str_replace("jpg ", "jpg?", $url); // added 3/3/18 Shreveport uses .jpg
$url = str_replace("gif ", "gif?", $url); // added 3/3/18 Fort Worth use .gif
global $noted;
- Jim
-
Thanks Jim!
-
Sorry I'm late to the party. Been traveling this past week and just got back last night.
Caught up on the developments and applied Jim's fixes and resolved that problem but I see a new problem, at least for me..
The Southern Region has switched their images url subfolders from /wxstory/ to /graphicast/ thus their images are not working.
I see the line that is probably the reason is my line#297
$wxsimage = 'https://www.weather.gov/images/'.$wswfo.'/wxstory/'.$imName.'.png'; // set image path
It probably needs an array to add the $wxsimage = 'https://www.weather.gov/images/'.$wswfo.'/graphicast/'.$imName.'.png'; // set image path
option but to be honest, arrays are not my forte.
-
rrrick8,
I have not had any problems. My images are showing for all Southern Region WFO's without your most recent edit. I should mention that I have disabled caching. Might this be the reason?
-
rrrick8,
I have not had any problems. My images are showing for all Southern Region WFO's without your most recent edit. I should mention that I have disabled caching. Might this be the reason?
Well, everything works for me except the Southern Region WFO's. I get the wording, just no images. I'm using V2.24 which I don't know if that was Curly's last or not. I was a beta tester for him and some of my scripts are from that endeavor and may not be his released version.
I have absolutely nothing in the script that mentions graphicast as a possible folder.
-
This is what I thought was his latest (2.23) but includes the recent fixes posted earlier.
-
Sorry to resurrect this-but I wanted to make a change.
92merc sent me the package and I have done what I thought was correct with all the instructions-but cannot get it to work.
To isolate the issue-I created a page with just the weather story. As you can see it just cuts off and stops. https://rms-weather.rdale.org/Weatherstory.php
I would not be surprised if it is a code issue on my end somehow. We all know my site is put together with duct tape and chicken wire.
Any help is appreciated. I try as best as a can.
-
bump.
Need help. Would like it to update itself instead of me doing it via Teamviewer.
-
Any chance you could post your code?
-
I can only do part of the code at a time. It will not let me attach php
$NWSregion = 'mpx'; // Enter your local NWS office three letter code
$useallwfos = true; // true=allow all WFO locations to be selected false=display only the default WFO
$wstitle = 'Weather Story'; // page title
$ourTZ = 'America/Chicago'; // Time Zone http://www.php.net/manual/en/timezones.america.php
$ws_cachetime = '30'; // time in minutes to hold cache files before updating fresh data ( 0 is not recommended)
$tablewdth = '700'; // displayed image width in pixels inside the table
// MAP & DATA SETTINGS
$useWFOmap = false; // true=use map to select WFO false=use drop down menu to select the WFO
$ws_mapfolder = '.images/'; // main map image file FOLDER
$ws_cachefolder = './wscache/'; // cache file FOLDER
$wfomaps = './wsimages/'; // folder containing individual WFO coverage maps
$mapname = 'WS_map'; // main map name - without extension
$ift = '.png'; // map image file extesion
$autocacheclean = true; // true=auto delete cache files older than 1 day false=keep cache files
// Download method
// IF downloading seems slow, change setting
$useCURL = false; // true=get data by cURL method false=stream data
### END OF SETTINGS ############################################################################################################
-
// set variables
$updateCache = true; // SET update cache file(s)
$updateTextTime = $ws_cachetime * 60; // change cache time minutes to seconds
$uts = date("U"); // current unix time stamp
$goodWFO = true;
$altStory = array();
$cft = '';
$hdline = '';
$hdlnr = array();
$imgMn = array();
$imgName = '';
$imName = '';
$ifn = '';
$mainStory = array();
$nfo = '';
$noted = '';
$wsdata = '';
$wxsimage = '';
// HTTPS sites
$usehttps = array('grr','iwx','lmk');
// old CRH or non working WFO codes
$nonWorkingCodes = array('akq','aly','bgm','boi','box','btv',
'buf','byz','cae','car','chs','cle',
'ctp','ggw','gsp','gyx','hnx','ilm',
'iln','lox','lwx','mhx','mlb','okx',
'pbz','phi','pih','pqr','psr','rah',
'rlx','rnk','sew','slc','tae','tfx',
'vef'
);
// home page WS WFO's - not in /weatherstory
$hpwxs2 = array('abq','ama','bmx','bro','crp','eka','epz','ewx','ffc',
'fgz','fwd','hgx','hun','jan','jax','key','lch','lix',
'lkn','lub','lzk','maf','meg','mfl','mfr','mob','mrx',
'mso','mtr','ohx','otx','oun','pdt','rev','sgx','shv',
'sjt','sju','sto','tbw','tsa','twc'
);
$hpwxs = array_merge($nonWorkingCodes, $hpwxs2);
// WFO code and location array as of 4/27/2017
$fo = array(
'abq' => 'Albuquerque',
'abr' => 'Aberdeen',
'afc' => 'Anchorage',
'afg' => 'Fairbanks',
'ajk' => 'Juneau',
'akq' => 'Wakefield',
'aly' => 'Albany',
'ama' => 'Amarillo',
'apx' => 'Gaylord',
'arx' => 'La Crosse',
'bgm' => 'Binghamton',
'bis' => 'Bismarck',
'bmx' => 'Birmingham',
'boi' => 'Boise',
'bou' => 'Denver/Boulder',
'box' => 'Boston',
'bro' => 'Brownsville',
'btv' => 'Burlington',
'buf' => 'Buffalo',
'byz' => 'Billings',
'cae' => 'Columbia',
'car' => 'Caribou',
'chs' => 'Charleston',
'cle' => 'Cleveland',
'crp' => 'Corpus Christi',
'ctp' => 'State College',
'cys' => 'Cheyenne',
'ddc' => 'Dodge City',
'dlh' => 'Duluth',
'dmx' => 'Des Moines',
'dtx' => 'Detroit/Pontiac',
'dvn' => 'Quad Cities',
'eax' => 'Kansas City/Pleasant Hill',
'eka' => 'Eureka',
'epz' => 'El Paso Area',
'ewx' => 'Austin/San Antonio',
'ffc' => 'Peachtree City',
'fgf' => 'Grand Forks',
'fgz' => 'Flagstaff',
'fsd' => 'Sioux Falls',
'fwd' => 'Fort Worth',
'ggw' => 'Glasgow',
'gid' => 'Hastings',
'gjt' => 'Grand Junction',
'gld' => 'Goodland',
'grb' => 'Green Bay',
'grr' => 'Grand Rapids',
'gsp' => 'Greenville-Spartanburg',
'gyx' => 'Gray/Portland',
'hfo' => 'Honolulu',
'hgx' => 'Houston/Galveston',
'hnx' => 'San Joaquin Valley/Hanford',
'hun' => 'Huntsville',
'ict' => 'Wichita',
'ilm' => 'Wilmington',
'iln' => 'Wilmington',
'ilx' => 'Central Illinois',
'ind' => 'Indianapolis',
'iwx' => 'Northern Indiana',
'jan' => 'Jackson',
'jax' => 'Jacksonville',
'jkl' => 'Jackson',
'key' => 'Key West',
'lbf' => 'North Platte',
'lch' => 'Lake Charles',
'lix' => 'New Orleans/Baton Rouge',
'lkn' => 'Elko',
'lmk' => 'Louisville',
'lot' => 'Chicago',
'lox' => 'Los Angeles/Oxnard',
'lsx' => 'St. Louis',
'lub' => 'Lubbock',
'lwx' => 'Baltimore/Washington',
'lzk' => 'Little Rock',
'maf' => 'Midland/Odessa',
'meg' => 'Memphis',
'mfl' => 'Miami-South Florida',
'mfr' => 'Medford',
'mhx' => 'Newport/Morehead City',
'mkx' => 'Milwaukee/Sullivan',
'mlb' => 'Melbourne',
'mob' => 'Mobile/Pensacola',
'mpx' => 'Twin Cities',
'mqt' => 'Marquette',
'mrx' => 'Morristown',
'mso' => 'Missoula',
'mtr' => 'San Francisco/Monterey Bay Area',
'oax' => 'Omaha/Valley',
'ohx' => 'Nashville',
'okx' => 'New York City/Upton',
'otx' => 'Spokane',
'oun' => 'Norman',
'pah' => 'Paducah',
'pbz' => 'Pittsburgh',
'pdt' => 'Pendleton',
'phi' => 'Philadelphia/Mount Holly',
'pih' => 'Pocatello',
'pqr' => 'Portland',
'psr' => 'Phoenix',
'pub' => 'Pueblo',
'rah' => 'Raleigh',
'rev' => 'Reno',
'riw' => 'Riverton',
'rlx' => 'Charleston',
'rnk' => 'Blacksburg',
'sew' => 'Seattle',
'sgf' => 'Springfield',
'sgx' => 'San Diego',
'shv' => 'Shreveport',
'sjt' => 'San Angelo',
'sju' => 'San Juan',
'slc' => 'Salt Lake City',
'sto' => 'Sacramento',
'tae' => 'Tallahassee',
'tbw' => 'Tampa Bay',
'tfx' => 'Great Falls',
'top' => 'Topeka',
'tsa' => 'Tulsa',
'twc' => 'Tucson',
'unr' => 'Rapid City',
'vef' => 'Las Vegas'
);
// set download method from main settings
($useCURL == true) ? $dldata = 'GetDataByCurl' : $dldata = 'getWSBystream';
-
// set download method from main settings
($useCURL == true) ? $dldata = 'GetDataByCurl' : $dldata = 'getWSBystream';
// set the time zone
date_default_timezone_set("$ourTZ");
// check for map in folder
if($useWFOmap == true and !file_exists($ws_mapfolder.$mapname.$ift)){ // IF use map and the map is not in the folder
$useWFOmap = false; // turn off map and use drop down menu
$noted .= "<!-- The required map is missing -->\n"; // display notice
}
// template map - ./folder/mapname.extension
$mainmap = $ws_mapfolder.$mapname.$ift;
// copy default WFO code
$wswfo = $NWSregion;
// Set the DEFAULT weather story & image
(in_array($wswfo, $hpwxs)) ? $wxsurl = 'http://www.weather.gov/'.$wswfo.'/' : $wxsurl = 'http://www.weather.gov/'.$wswfo.'/weatherstory';
// IF the WFO is using https
if(in_array($wswfo, $usehttps)){$wxsurl = preg_replace('/https:/', 'https:', $wxsurl);} // change http to https
// auto clean cache file
$defcachedata = $ws_cachefolder.'wsdata_'.$NWSregion.'.php'; // default WFO data file
if(is_file($defcachedata) and filemtime($defcachedata) < strtotime("today")){ // IF default WFO cache file is found AND the filetime is older than today
if($autocacheclean == true and $ws_cachefolder != './cache/'){ // IF auto cache clean is true AND not in a default cache folder
$cfs = array(); // set array
$i = 0; // set counter
foreach (glob($ws_cachefolder."ws*.*") as $cachedfile) { // FOR EACH file in the cache folder
if(filemtime($cachedfile) < strtotime("today")){ // IF the file time is older than today - before 12:00am
$cfs[] = filesize($cachedfile); // set the cache file size
unlink($cachedfile); // delete the file
$i++; // increment counter
}
}
$dfs = array_sum($cfs); // get the deleted cache file size sum
$fb = getFileSize($dfs); // set to mbytes or gbytes
$noted .= "<!-- Cache files deleted: $i - $fb -->\n"; // display notice
}
}
// print_r($wxsurl); echo "<br />\n";
// get submitted location
if(isset($_GET['i']) and strlen($_GET['i']) == "3"){ // IF a WFO was selected
$newwswfo = $_GET['i']; // get the location
$wswfo = htmlspecialchars(strip_tags($newwswfo)); // clean the location
$wxsurl = 'http://www.weather.gov/'.$wswfo.'/weatherstory'; // set the link
if(in_array($wswfo, $hpwxs)){ // IF the WS is on the WFO home page
$wxsurl = 'http://www.weather.gov/'.$wswfo.'/'; // change the path
}
if(in_array($wswfo, $usehttps)){ // IF the WFO is using https
$wxsurl = preg_replace('/http:/', 'https:', $wxsurl); // change http to https
}
// MAP CREATION
if($useWFOmap){ // IF using the map feature
$mm = imagecreatefrompng($mainmap); // creat map from map template
$orig_size = getimagesize($mainmap); // get original map size
$red = imagecolorallocate($mm, 255, 0, 0); // designate red because of county color
imagecolortransparent($mm, $red); // make transparent color
$im = imagecreatetruecolor($orig_size[0], $orig_size[1]); // create blank image the size of the map
$id = imagecreatefrompng($wfomaps.$wswfo.'.png'); // create image from county alert png file
imagecopymerge($mm, $id, 0, 0, 0, 0, $orig_size[0],$orig_size[1] ,100); // merge the county image to the map image
imagedestroy($id); // destroy the original county image
imagepng($mm, $ws_cachefolder.$mapname.$ift,2); // save the image
imagedestroy($im); // destroy the transparent image
$swfoi = $ws_cachefolder.$mapname.$ift; // set selected WFO image
}
}
else{ // OR ELSE if no selection, create default location map
if($useWFOmap){
if(!file_exists($ws_cachefolder.$mapname.$NWSregion.'.png')) { // IF the WFO boundary image is found
$mm = imagecreatefrompng($mainmap); // create image from US map file
$orig_size = getimagesize($mainmap); // get original map size
$red = imagecolorallocate($mm, 255, 0, 0); // designate red because of county color
imagecolortransparent($mm, $red); // make transparent color
$im = imagecreatetruecolor($orig_size[0], $orig_size[1]); // create blank image the size of the map
$id = imagecreatefrompng($wfomaps.$wswfo.'.png'); // create image from county alert png file
imagecopymerge($mm, $id, 0, 0, 0, 0, $orig_size[0],$orig_size[1] ,100); // merge the county image to the map image
imagedestroy($id); // destroy the original county image
imagepng($mm, $ws_cachefolder.$mapname.$NWSregion.'.png',2); // save the image
imagedestroy($im); // destroy the transparent image
}
$swfoi = $ws_cachefolder.$mapname.$NWSregion.'.png'; // set default WFO image
}
}
// get submitted image
if(isset($_GET['ifn'])){ // IF a headline was selected
$imName = htmlspecialchars(strip_tags($_GET['ifn'])); // clean up the name
$wxsimage = 'http://www.weather.gov/images/'.$wswfo.'/wxstory/'.$imName.'.png'; // set image path
$noted .= "<!-- $imName selected -->\n"; // display notice
}
// create unique cache filenames
$wsimg = $ws_cachefolder.'wsimg_'.$wswfo.'.png'; // Weather Story image
$ws_cachefile = $ws_cachefolder.'wsdata_'.$wswfo.'.php'; // Weather Story text
// update cache file policy
if(file_exists($ws_cachefile)) { // IF the data cache file exists
$cft = filemtime($ws_cachefile); // get cache file last modified time
$cfAge = $uts - $cft; // get cache file age in seconds
if($cfAge < $updateTextTime) { // IF cache file has not expired
$updateCache = false; // don't update
$noted .= "<!-- Cached data displayed -->\n"; // display notice
}
if(!empty($_GET['mu'])) { // IF you want to manually update the report webpagefilename.php?mu=1
$updateCache = true; // set update cache
$noted .= "<!-- manually updated -->\n"; // display notice
}
}
// IF the WFO code is in the above array, set the location
if(array_key_exists($wswfo, $fo)){
$nfo = $fo[$wswfo];
}
if($updateCache) { // IF the cache file needs updating
if(!$html = $dldata($wxsurl)) { // IF the weather story is not found
$noted .= "<!-- First attempt in getting NWS URL data failed -->\n"; // create note
sleep(1); // wait a second !
if(!$html = $dldata($wxsurl)) { // IF the second chance WS fails
sleep(1); // wait a second...
$noted .= "<!-- Second attempt in getting NWS URL data failed -->\n"; // create note
if(!$html = $dldata($wxsurl)) { // IF the last chance to get the WS failed
$html = ''; // set data to null
$noted .= "<!-- FAILURE: Could not get the WS data after 3 attempts -->\n"; // create note
}
}
}
// fix characters
$html = preg_replace('/°/', '°', $html); // change it to an entity
$html = preg_replace('/‘/', '\'', $html); // change stray character
$html = preg_replace('/<u>/', '', $html); // fix error
$html = preg_replace('/<\/u>/', '', $html); // fix error
$html = preg_replace('/<br>/', '<br />', $html); // fix error
// MAIN IMAGE URL
preg_match('|c-tab__content">.*image"><img s.*"(.*)" style|Uis', $html, $image); // search for the image
if(isset($image[1])){ // IF the image is available
$iurl = $image[1]; // pick out the image URL
if(!preg_match("|http|",$iurl)) {$iurl = 'http://www.weather.gov'.$iurl;}
$emi = explode("/", $iurl); // split up the URL
$imgMn = array_pop($emi); // get file name from the last array
$ifn = substr($imgMn, 0, -4); // cut off the extension - image file name w/o extension
$ift = substr($imgMn, -3, 3); // get the image file type/extension
$di = $dldata($iurl); // get the image
$wxsimage = $ws_cachefolder.'wsimg_'.$wswfo.'_'.$ifn.'.'.$ift; // assemble image cache file name
$wsif = fopen($wxsimage, 'w'); // open weather story image file
fwrite($wsif, $di); // write image file to cache folder
fclose($wsif); // close weather story image file
$noted .= "<!-- Weather Story image downloaded -->\n"; // display remark
// MAIN DESCRIPTION TEXT
preg_match('|is-active">.*description">(.*)</div>|Uis', $html, $story); // search for the story
(isset($story[1])) ? $wsdata = $story[1] : $wsdata = ''; // IF the story is found, set variable
// remvoe added non-story information
if($wsdata <> '' and preg_match('/<hr>/Uis', $wsdata)){ // IF data shows a horizontal rule
$wsdata = preg_replace('/<hr>.*/', ' +more', $wsdata); // delete the hotizontal line and everythig after it
}
$wsdata = preg_replace("/target='_blank'/", 'onclick="window.open(this.href,\'_blank\');return false;"', $wsdata); // fix to validate
if(mb_detect_encoding($wsdata) == 'UTF-8'){ // IF character encoding is set to URF-8
$wsdata = html_entity_decode(strip_tags($wsdata)); // decode story text html enities
$wsdata = htmlentities($wsdata); // convert all story text html entities
$noted .= "<!-- UTF-8 was detected in the main story -->\n"; // create note
}
// print_r($wsdata); echo "<br />\n";
-
// MAIN HEADLINE
preg_match('|c-tabs-nav__link is-active"><span>(.*)</span>|Uis', $html, $hdln); // search for the story headline
(isset($hdln[1])) ? $wshdlne = $hdln[1] : $wshdlne = ''; // IF the headline is found, set variable
$wshdlne = html_entity_decode($wshdlne); // decode headline html enities
$wshdlne = preg_replace('/ & /', ' & ', $wshdlne); // convert headline html entities
$mainStory[$ifn] = array($wshdlne, $wsdata, $iurl, $wxsurl, $wxsimage, $ift, $ifn, $wswfo, $nfo); // array for cache file
if($wshdlne <> ''){ // IF there is a headline, create table div
$hdlnr[] = ' <td style="text-align: center; background-color:#F0F7FF; padding: 6px 0px 6px;"><a href="'.
$_SERVER['PHP_SELF'].'?i='.$wswfo.'&ifn='.$ifn.'" title="'.$wshdlne.
'" style="text-decoration: none; color: #0071BC; font-size: 1.3em;">'.$wshdlne.'</a></td>';
}
else{
$hdlnr[] = ' <td style="text-align: center; background-color:#F0F7FF; padding: 6px 0px 6px;"><a href="'.
$_SERVER['PHP_SELF'].'?i='.$wswfo.'&ifn='.$ifn.'" title="'.$wshdlne.
'" style="text-decoration: none; color: #0071BC; font-size: 1.3em;">Weather Story</a></td>';
}
// ALTERNATE HEADLINE & DESCRIPTION & LINK
preg_match_all('|c-tabs-nav__link"><span>(.*)</span>|Uis', $html, $hdlnAlt); // search for any ALTERNATE story headlines
if(!empty($hdlnAlt[1])){ // IF any alternative headlines are found
preg_match_all('|c-tab">.*description">(.*)</div>|Uis', $html, $altstory); // get the story
preg_match_all('|c-tab">.*image"><img src="(.*)" style|Uis', $html, $altImage); // get the image URL
foreach($hdlnAlt[1] as $ahk => $ahv){ // FOR EACH alternative headline
$ai = $altImage[1][$ahk]; // get the alternate image URL
if(!preg_match("|http|",$ai)) {$ai = 'http://www.weather.gov'.$ai;} // IF the alternate image URL is incomplete, add pefix
$eai = preg_split('/\//', $ai); // split up the URL
$imgalt = array_pop($eai); // get the file name and extension
$imgAlt = substr($imgalt, 0, -4); // cut off the extension - image file name w/o extension
$aift = substr($imgalt, -3, 3); // get the image file type/extension
$awxsimage = $ws_cachefolder.'wsimg_'.$wswfo.'_'.$imgAlt.'.'.$aift; // assemble image cache file name
$wshdlne = $ahv; // get alternate headline
$wshdlne = html_entity_decode($wshdlne); // decode stray headline html enities
$wshdlne = preg_replace('/ & /', ' & ', $wshdlne); // convert headline html entities
$altstry = html_entity_decode($altstory[1][$ahk]); // decode stray story text html enities
$altstry = preg_replace("/target='_blank'/", 'onclick="window.open(this.href,\'_blank\');return false;"', $altstry); // fix to validate
$altstry = preg_replace('/&/', '&', $altstry); // convert headline html entities
if(mb_detect_encoding($altstry) == 'UTF-8'){ // IF character encoding is set to URF-8
$altstry = html_entity_decode(strip_tags($altstry)); // decode story text html enities
$altstry = htmlentities($altstry); // convert all story text html entities
$noted .= "<!-- UTF-8 was detected in an alternate story -->\n"; // create note
}
$altStory[$imgAlt] = array($wshdlne, $altstry, $ai, $wxsurl, $awxsimage, $aift, $imgAlt, $wswfo, $nfo); // create array
$hdlnr[] = ' <td style="text-align: center; background-color:#F0F7FF; padding: 6px 0px 6px;"><a href="'.$_SERVER['PHP_SELF'].'?i='.
$wswfo.'&ifn='.$imgAlt.'" title="'.$wshdlne.'" style="text-decoration: none; color: #0071BC; font-size: 1.3em;">'.$wshdlne.'</a></td>';
}
}
$focf = fopen($ws_cachefile,'wb'); // open the text cache file
if($focf) { // IF cache file opens
fwrite($focf, "<?php\n\n"); // write
fwrite($focf, '$mainStory = '.var_export($mainStory, 1).";\n\n"); // write the main story data
fwrite($focf, '$altStory = '.var_export($altStory, 1).";\n\n"); // write the alternate story data
fwrite($focf, '$nfo = '.var_export($nfo, 1).";\n\n"); // write the foreccast office name
fwrite($focf, '$hdlnr = '.var_export($hdlnr, 1).";\n\n"); // write the headline data
fwrite($focf, "\n?>"); // end of the php code
fclose($focf); // close the file
$noted .= "<!-- Cache file written -->\n"; // display notice
}
}
else { // OR ELSE if a weather story was not posted at the WFO
$onfo = $nfo; // copy WFO location name
if(is_file($ws_cachefile) and $wswfo != $NWSregion){ // IF the data cache file exists AND it not the default WFO
unlink($ws_cachefile); // delete the file
$noted .= "<!-- Weather Story is not available for $nfo -->\n"; // display remark
// create the headliner
$hdlnr[] = '<td style="text-align: center; background-color:#F0F7FF; color:#FFF; padding: 6px 0px 6px;; font-size: 1.3em">Today\'s Weather Story has not been posted for '.$onfo.'</td>';
}
// IF a WFO is selected without a WS, create the headliner
elseif(in_array($wswfo,$nonWorkingCodes)){
$noted .= "<!-- $onfo does not have the new weather story -->\n"; // display notice
$hdlnr[] = '<td style="text-align: center; background-color:#F0F7FF; color:#FFF; padding: 6px 0px 6px;; font-size: 1.3em">'.$onfo.' does not have the Weather Story</td>';
}
// IF a weather story WFO without a weatherstory folder is selected, create the headliner
elseif(in_array($wswfo,$hpwxs2)){
$hdlnr[] = '<td style="text-align: center; background-color:#F0F7FF; color:#FFF; padding: 6px 0px 6px;; font-size: 1.3em">Today\'s Weather Story has not been posted for '.$onfo.'</td>';
$noted .= "<!-- $onfo does not have the weather story in their home page -->\n"; // display notice
}
// OR ELSE create the headliner
else {
$hdlnr[] = '<td style="text-align: center; background-color:#F0F7FF; color:#FFF; padding: 6px 0px 6px;; font-size: 1.3em">Today\'s Weather Story has not been posted for '.$onfo.'</td>';
$noted .= "<!-- $onfo does not have the weather story -->\n"; // display notice
}
$goodWFO = false;
}
}
// end of updating cache file
-
// set page title
$wstitle2 = '<span style="color:#0061AC;">'.strtoupper($wstitle).'</span><br />'.$nfo.'<br /><span style="font-size:60%; vertical-align: text-top;">Weather Forecast Office</span>';
// include the cache file
if(is_file($ws_cachefile)){
include($ws_cachefile);
}
// get submitted image
if(isset($_GET['ifn']) and $wswfo){ // IF the WFO was submitted
$imgname = htmlspecialchars(strip_tags($_GET['ifn'])); // get the WFO code
if(!array_key_exists($imgname, $mainStory) and !array_key_exists($imgname, $altStory)){ // IF the name is not a key in either array
$mskey = key($mainStory); // get the main story array key
$imgname = $mskey; // change the image name to the mainstory name
$altStory = $mainStory; // change the alternate story to the main story
$noted .= "<!-- An invalid file name was selected -->\n"; // display notice
}
$mskey = key($mainStory); // get the main story array key
($mskey != $imgname) ? $altStory = $altStory : $altStory = $mainStory; // IF the selected story is the same as the main story, set variable back to the main data
$wsimg = $altStory[$imgname][4]; // get the cached image file name
$wswfo = $altStory[$imgname][7]; // get the WFO code
$wxsurl = $altStory[$imgname][3]; // get the NWS story text link
$wsdata = $altStory[$imgname][1]; // get the story headline
$nfo = $altStory[$imgname][8]; // get the WFO location
$imName = $altStory[$imgname][6]; // use main story image file name
$imagepath = $altStory[$imgname][4]; // get the cached image path
$wshdlne = $altStory[$imgname][0]; // get the headline
$wxsimage = $imagepath; // copy the image cache path
if(file_exists($imagepath)) { // IF the iamge cache file exists
$cft = filemtime($imagepath); // get cache file last modified time
$cfAge = $uts - $cft; // get cache file age in seconds
if($cfAge > $updateTextTime) { // IF cache file has expired
if($mskey != $imgname) { // IF the image cache file does not exist
$di = $dldata($altStory[$imgname][2]); // get the image from the NWS
$icf = fopen($imagepath, 'w'); // open the image cache file
fwrite($icf, $di); // write image file in cache folder
fclose($icf); // open the image cache fil
$noted .= "<!-- Weather Story image downloaded ! -->\n"; // display remark
}
}
}
else{ // OR ELSE
$di = $dldata($altStory[$imgname][2]); // get the image
$aicf = fopen($imagepath, 'w'); // open the alternate image cache file
fwrite($aicf, $di); // write image file in cache folder
fclose($aicf); // close the file
$noted .= "<!-- Weather Story image downloaded -->\n"; // display remark
}
}
else { // OR ELSE
if($goodWFO){
$curkey = key($mainStory); // ket main story key
$wsimg = $mainStory[$curkey][4]; // use main story image
$wswfo = $mainStory[$curkey][7]; // use main story WFO
$wxsurl = $mainStory[$curkey][3]; // use main story cached file
$wsdata = $mainStory[$curkey][1]; // use main story cached text
$nfo = $mainStory[$curkey][8]; // use main story cached location
$imName = $mainStory[$curkey][6]; // use main story image file name
$wshdlne = $mainStory[$curkey][0]; // use main story headline
}
}
// Change headline colors after selection
$hdlrcount = count($hdlnr); // count the headlines
$hdlnrwidth = round($tablewdth / $hdlrcount); // get width of headline from table width
foreach($hdlnr as $hk => $hv){ // FOR EACH headline
if(preg_match("|$imName|",$hv)) { // IF the selected image is in the headline
$hv = preg_replace('/-color:#F0F7FF/', '-color:#0071BC', $hv); // change background color to blue
$hv = preg_replace('/ color: #0071BC/', ' color:#FFF', $hv); // change text color to white
$hv = preg_replace('/td style="/', 'td style="width:'.$hdlnrwidth.'px; ', $hv); // adjust column width
}
else{ // OR ELSE
$hv = preg_replace('/ background-color:#F0F7FF;/', '', $hv); // change background color to a light color
$hv = preg_replace('/td style="/', 'td style="width:'.$hdlnrwidth.'px; ', $hv); // change column width
$hv = preg_replace('/td style="/', 'td class="hdline" style="border-bottom: thin solid #0071BC; border-top: thin solid #0071BC; ', $hv); // change column width
}
$hdline .= $hv."\n";
}
// print_r($wswfo); echo "<br />\n";
-
// FUNCTION - get data cURL
function GetDataByCurl($url) {
global $noted; // set global
$data = ''; // set variable
$ch = curl_init(); // initialize a cURL session
curl_setopt($ch, CURLOPT_URL, $url); // connect to provided URL
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // don't verify peer certificate
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:14.0) Gecko/20100101 Firefox/14.0.1 (.NET CLR 4.0.20506)');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4); // 3 sec connection timeout
curl_setopt($ch, CURLOPT_TIMEOUT, 3); // 2 sec data timeout
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return the data transfer
curl_setopt($ch, CURLOPT_FOLLOWLOCATION , true); // follow HTTP 3xx redirects
curl_setopt($ch, CURLOPT_NOBODY, false); // set nobody
curl_setopt($ch, CURLOPT_HEADER, false); // do not pass headers to the data stream
$data = curl_exec($ch); // execute session
if(curl_error($ch) <> '') { // IF there is an error
$noted .= "<!-- Error: ". curl_error($ch) ." -->\n"; // display error notice
$noted .= "<!-- cURL Error at $url -->\n"; // display error source notice
}
$header_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); // set header information
curl_close($ch); // close the cURL session
if(preg_match('/text\/html|image\/png|image\/gif|image\/jpeg|image\/jpg/',$header_type)) { // IF text/html is found in the header
$data = $data; // set data
$noted .= "<!-- cURL Data source: $url -->\n"; // display notice
}
else { // OR ELSE
$noted .= "<!-- cURL error source: $url -->\n"; // display error source notice
$data = ''; // set data to null value
}
return $data; // return data
}// end GetDataByCurl
// FUNCTION - Get file contents
function getWSBystream($url) {
global $noted;
$hdropts = array('http' => array('method'=>"GET",
"timeout" => 3,
'header'=>"Cache-control: max-age=0\r\n" .
"Connection: close\r\n" .
"User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:14.0) Gecko/20100101 Firefox/14.0.1 (.NET CLR 4.0.20506)\r\n" .
"Accept: text/html; image/png; image/gif; image/jpeg; image/jpg\r\n"
)
);
$context = stream_context_create($hdropts);
if(@$data = file_get_contents($url,false,$context)){
$noted .= "<!-- Stream data source: $url -->\n"; // display notice
}
else{
$data = '';
$noted .= "<!-- Stream failure source: $url -->\n"; // display notice
}
return $data;
} // end function getWSBystream
// FUNCTION - File size
function getFileSize($bytes) {
$precision = 2;
$units = ['Bytes', 'Kilobytes', 'Megabytes', 'Gigabytes', 'Terabytes'];
$i = 0;
while($bytes > 1024) {
$bytes /= 1024;
$i++;
}
return round($bytes, $precision) . ' ' . $units[$i];
}
?>
<table border="0" cellspacing="0" cellpadding="0" style="width: <?php echo $tablewdth ?>px; margin: 20px auto 0px auto;">
<tr>
<td style="text-align:center;"><a href="<?php echo $wxsurl; ?>" onclick="window.open(this.href,'_blank');return false;" title="Click to view this forecast office" style="text-decoration: none; color: inherit;"><span style="font-size:20px; letter-spacing:2px;"><b><?php echo $wstitle2 ?></b></span></a></td>
</tr>
</table>
-
Then assuming the rest is ok I have not changed it.
-
That is old code. For starters try changing all references from http://www.weather.gov/ (http://www.weather.gov/) to https://www.weather.gov/ (https://www.weather.gov/) The script will likely jump back to life. If it doesn't I posted the most recent version a few posts up in this thread a while back. Try that version and make the changes you require.
-
also assuming all folders need to be in the same place. Which they are.
is the recall line still the same?
I also changed the number from 0 to 5.
Give it time but nothing yet.
-
Did you try the version I posted?
-
Yes the one from Mar 14, 2018.
-
Check your PM's
-
Nothing I have tried has worked.
I was able to Iframe tmabell's info to my page-but that is not fair to his system.
He made/edited a script for me.
I am thinking either an issue with the call script or my template. So I have removed it.
Something else has to be the issue. Please help.
edit: here is my page with everything removed but weather story
https://rms-weather.rdale.org/weatherstory.php
I did use this for the call script and it allowed the page to finish.
<?php include("https://rms-weather.rdale.org/ChiefDavid1.php"); ?>
The frame on there is an iframe of my ChiefDavid1 page. Nothing in it.
-
We know the script works because as you stated, it works on my server here. Check your server's error logs. When your script is viewed from the outside I get this (using Chromes Developer Tools) "Failed to load resource: the server responded with a status of 500 (Internal Server Error)"
Hopefully, the server's error log will provide a clue.
-
I will get ahold of IT and see if they can do anything. I do know there are no images in any folder.
-
There has to be an issue with server.
So I was able to iframe the weather story page to focus on the story part and not see the rest of the page.
-
Try putting this at the top of the script and see what comes back ..
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
error_reporting(E_ALL);
-
Does someone have the newest WxStory_inc.php v2.24 script they could share?
For some reason, ever since I upgraded my VPS server, I only get the main story pics no Alternate pics. The written text comes thru fine but none of the alternate pics. They are not being produced into the wscache folder.
This occurs on every site I try. I need to compare my script to a working one to see if I changed something along the way.
Thanks.
-
Does someone have the newest WxStory_inc.php v2.24 script they could share?
For some reason, ever since I upgraded my VPS server, I only get the main story pics no Alternate pics. The written text comes thru fine but none of the alternate pics. They are not being produced into the wscache folder.
This occurs on every site I try. I need to compare my script to a working one to see if I changed something along the way.
Thanks.
Reply #14 in this thread has a link to v2.25
-
Thanks Eric for the link. I had definitely missed that.
Applied the couple of changes and now all working fine
-
Not sure how I'd missed this wonderful tool until now. I'll be using this as an include on a page with other data, but I know for a fact my local WFO doesn't generate a weather story daily. I'm not too fond of an image placeholder if there's no current weather story... I don't suppose anyone out there has a mod to suppress the weather story code entirely if there's no current images?
If not, no worries...
Thanks,
Grant
-
Hi All,
I have not used this script as it does not include Hawaii and Alaska.
Hope maybe one day we could be included?
Aloha.
--Stan Y.
Maui, Hawaii
-
The NWS offices in Alaska and Hawaii do not make the Weather Story available so they cannot be included in the script.
-
Thanks for the reply tmabell. That is what I would have thought but maybe one of these days they will have one, so we will be able to be added to this script.
Aloha,
--Stan Y.
Maui, Hawaii
-
The NWS offices in Alaska and Hawaii do not make the Weather Story available so they cannot be included in the script.
Never say never. Took a long time for Eastern Region to use it.
-
Wasn't sure if I should add to this thread or create a new one. Anyways... I thought I had this script working but it looks like the cached images are randomly created as empty files, zero bytes. Any ideas on what to look for? Thank you
http://weavernet.dyndns.org/etnwx/wxStory.php (http://weavernet.dyndns.org/etnwx/wxStory.php)
-
I tried v2.25 and the stories wont show up. My cache directory looks good. Got the permissions set to 775.
https://www.northbendweather.com/wxstory.php
My local NWS does publish stories almost everyday. https://www.weather.gov/sew/
Any ideas? Running php 7.2
-
No idea but interesting. I can see the image when viewed with my site/page. Yours has the text just not the image, strange. Will be interested in the answer. Wish I could help.
UPDATE: just went to add the link from my site and the Seattle Wx Story is gone, just like that.
-
I tried v2.25 and the stories wont show up. My cache directory looks good. Got the permissions set to 775.
https://www.northbendweather.com/wxstory.php
My local NWS does publish stories almost everyday. https://www.weather.gov/sew/
Any ideas? Running php 7.2
same the only story that shows up for me is KIND. for now I just $useallwfos = false;
update none seem to work now..
-
ya idk what's going on how to fix it i even went back to 2.24 and it still doesn't work, when it use to.
-
Ver 2.25 has been tweaked a few times to address these issues. Try my version which has been updated and is currently working.
-
Ver 2.25 has been tweaked a few times to address these issues. Try my version which has been updated and is currently working.
I can see other Story pics but IND .. maybe i need to clear my wscache folder as shows the files but for the pic its wsimg_ind_Tab2FileL.png?1978e7d7654242cfc1bcc4de6247.1e4
edit: update your file worked! and cleared my wscache too thanks :)
-
Your file worked for me too. Thanks.
-
I'm thinking that with the tweaks I mentioned that perhaps we should refer to this as Ver 2.25b? Maybe Ken has thoughts on giving it the once over and an upgraded version number so as to keep confusion to a minimum. \:D/
-
mine is not loading. anyone else having issues?
https://bsmweather.org/weatherstory.php
-
All dead but 2 in ND and one in MN for the past 2 days. It looks like the NWS has abandoned it, but time will tell.
-
It's not posting on the CWA's websites but it is there, or at least part of it is. At least is for ILX and some others I checked.. I just right clicked the Wxstory icon on their website home page and opened image in new tab.
Hopefully just a momentary hiatus.
-
Guessing it is a "Its not you" problem. Headlines are updating. Not pics.
Oh well
-
It's them... see https://www.nco.ncep.noaa.gov/status/messages/ for status. Last status said
SENIOR DUTY METEOROLOGIST NWS ADMINISTRATIVE MESSAGE
NWS NCEP CENTRAL OPERATIONS COLLEGE PARK MD
0142Z FRI MAR 05 2021
The 00Z NCEP model production suite is currently running on time.
00Z NAM RAOB RECAP...
91334/TKK - Purged temp/moisture 600-319...spurious temps
70414/SYA - 10159
76405/LAP - 10158
72694/SLE - Part A missing
WEATHER STORY GRAPHICS UPDATE...
Multiple NCO teams remain engaged in troubleshooting an issue
with Weather Story Graphics not updating on WFO websites. No ETR.
Gerhardt/SDM/NCO/NCEP
-
I noticed my pictures not updating too. But If I click on the title bar, it'll suddenly load the pic just fine.
-
Looks like the NCO OPS found the 'magic sauce' to apply
SENIOR DUTY METEOROLOGIST NWS ADMINISTRATIVE MESSAGE
NWS NCEP CENTRAL OPERATIONS COLLEGE PARK MD
1643Z FRI MAR 05 2021
...WEATHER STORY WEB POSTING RESTORED...
The earlier problem with Weather Stories have been resolved.
If users experience further issues, please contact Tech
Control by email at nco.ops@noaa.gov or by phone at
301-683-1518.
Shruell/SDM/NCO/NCEP
-
Great! Thanks, Ken. [tup]
-
Hi All,
Still waiting for Hawaii to come aboard on this subject.
We had an tsunami alert from the New Zealand 8.1 earthquake yesterday. Nothing reached here. Its a good thing.
Aloha,
--Stan Y.
Maui, Hawaii
-
As a side, if you didn't know, the Western Region Headquarters has a National Weather Story Map where at a glance you can see which site is active. If you see the common black square with writing, which is predominate in the west on the below image, the Wxstory hasn't been issued today yet.
https://www.weather.gov/wrh/weatherstory_map (https://www.weather.gov/wrh/weatherstory_map)
[ You are not allowed to view attachments ]
-
Unfortunately the map doesn't display the ND WFO's and the Duluth WFO. What's more, the 'black' images in the WRH WFO's aren't current at this time. Those Weather Stories are actually there right now.
It's a nice idea, but the implementation is lacking. :-(
-
As a side, if you didn't know, the Western Region Headquarters has a National Weather Story Map where at a glance you can see which site is active. If you see the common black square with writing, which is predominate in the west on the below image, the Wxstory hasn't been issued today yet.
https://www.weather.gov/wrh/weatherstory_map (https://www.weather.gov/wrh/weatherstory_map)
[ You are not allowed to view attachments ]
I love how the pic for Des Moines is in western Iowa. West of Denison in the Bluffs.
-
Unfortunately the map doesn't display the ND WFO's and the Duluth WFO. What's more, the 'black' images in the WRH WFO's aren't current at this time. Those Weather Stories are actually there right now.
It's a nice idea, but the implementation is lacking. :-(
My reference to it is use of being a quick reference to be able to see if it is a national outage as opposed to specific WFO. No, you can see from the time stamps that many are not current.
I love how the pic for Des Moines is in western Iowa. West of Denison in the Bluffs.
I'm sure that is done just so not to cover other WFO pics.
-
So I see now that all of the east coast has a wxStory but is formatted a bit different that the script doesn't fetch the images and text.
Anyone up to updating the wxStory_inc.php script to fetch their data as well. Don't think it would take a lot. Just adding a way to look for their preg_match identifyers as well. Above my pay grade though. I'll be happy to update the map with all green in the eastern region if completed.
-
Ok, I have installed this script on my page at https://csraweather.org. The script says my local forecast office KCAE (Columbia , S.C. WFO) does not have a Weather Story. When I log on to weather.gov/cae, there is a Weather Story on the website. Could someone please advise? Thank You in advance!
-
See the post above, right before yours.
-
You should have both the wxstory.php file and wxStory-inc.php.
Inside the INC file at the top, there is a $NWSregion. That should be set to 'cae'. Once set, that is usually it.
-
Thank you, Sir! I will double check my configs….
-
I hate to be redundant but sometimes posts get overlooked. Please peruse the earlier post by rrrick8. There is no way presently to add an Eastern Region WFO's Weather Story to this script.
-
Thanks for the update, oh well….
-
Are we still unable to include the Eastern office's Weather Story Data?
-
Melbourne, FL is the only 'red' WFO on the map (https://www.gwwilkins.org/wxstory.php) in the Eastern offices' that currently has a weather story, so no. And it's a shame that not more WFO's in the East publish a weather story.
-
Melbourne, FL is the only 'red' WFO on the map (https://www.gwwilkins.org/wxstory.php) in the Eastern offices' that currently has a weather story, so no. And it's a shame that not more WFO's in the East publish a weather story.
I check the eastern region often and it now seems like most of them DO have a weatherstory page but something in the code (above my paygrade) is not identifying it and displaying it.
-
They seem to be following the beats of their own drummers. Here's State College's offering (https://www.weather.gov/ctp/weatherstory) for example.
How is Curly's script going to accommodate this slide show?
-
They seem to be following the beats of their own drummers. Here's State College's offering (https://www.weather.gov/ctp/weatherstory) for example.
How is Curly's script going to accommodate this slide show?
It's a gif so think that wouldn't be a great deterrence.
-
They seem to be following the beats of their own drummers. Here's State College's offering (https://www.weather.gov/ctp/weatherstory) for example.
How is Curly's script going to accommodate this slide show?
It's a gif so think that wouldn't be a great deterrence.
I look forward to seeing your work. :-)
-
I have noticed my office rnk has started having a story but I don’t know
if it’s a permanent thing or they are just experimenting with it. I’ll try to pay closer attention
and see if it returns
-
They seem to be following the beats of their own drummers. Here's State College's offering (https://www.weather.gov/ctp/weatherstory) for example.
How is Curly's script going to accommodate this slide show?
It's a gif so think that wouldn't be a great deterrence.
I look forward to seeing your work. :-)
My point is that gifs are already used by some sites in their weather stories. Usually animated radar. So it seems that the script already handles gif images. As i said. Above my paygrade though.
-
I took a look and it's also definitely above my pay grade. There are some gurus on this site who might be able task it, but their time is their own.
-
I took a look and it's also definitely above my pay grade. There are some gurus on this site who might be able task it, but their time is their own.
I went ahead and made a page for myself that has all the CWA's in it. Most work except for a very few out west but I anticipate them using the same format as the working ones out west when they come on line. It would probably make Ken cringe at the use of iframes but it works so I'm fine with it. Arrays are not my forte, so I just created an iframe template and used it on each CWA in a folder then call them individually via the map.
Until something better comes along I'll fake it until I can make it. :lol:
Here is the page it's on, directly below the NWS-forecast-map. http://vermilionweather.com/forecast.php (http://vermilionweather.com/forecast.php)
-
(https://jcweather.us/WS_mapSmall.png) wxStory 3.0 has been posted in a fresh thread https://www.wxforum.net/index.php?topic=43711.new#new, and that should be used in the future for the script. - Jim