PHP Scripts
Requirements:
- PHP
- JpGraph is required for the graphs.
- Please mention www.newquayweather.com if you use my scripts
For those using my scripts, replace url line in each script or download zips
Sunspots image url updates new urls, zips now updated
sunspots30day.php
$bgimageurl="https://soho.nascom.nasa.gov/data/realtime/hmi_igr/512/latest.jpg"; // background image
sunspots-qtr.php
$bgimageurl="https://soho.nascom.nasa.gov/data/realtime/eit_304/512/latest.jpg"; // EIt 304 lastest image 11-04-2022
sunspots-year.php
$bgimageurl="https://soho.nascom.nasa.gov/data/synoptic/sunspots_earth/mdi_sunspots.jpg"; // Updated 11-4-2022
sunspots-year1700.php
$bgimageurl="https://soho.nascom.nasa.gov/data/realtime/hmi_mag/512/latest.jpg"; // HMI Magnetogram Image 11-04-2022
To
$ftp_server = "http://services.swpc.noaa.gov/text/daily-solar-indices.txt";
Also the last qtr script no longer has a data file to download from swpc, so remove
Script | Description | Last UpDate | Example | Download |
Sunspots yesterdays total | Displays a text ouptut of yesterdays sunspot number | 9th April, 2017 | 148 + example on home page dashboard | ZIP |
Sunspots 30 day | Displays graph of last 30 days sunspot numbers | 11th April, 2022 | Example - popup | ZIP |
Sunspots 1700 to last year | Displays graph of average yearly sunspots since 1700 | 11th April, 2022 | Example - popup | ZIP |
Sunspots last 30 days Table | Displays a table of last 30 days | 7th January, 2015 | Example - popup | ZIP |
Sunspots year graph / table | Displays a graph for current year, require sunspots 2022 file below, table script inc | 11th April, 2022 | Example - popup | ZIP |
Sunspots 2022 text file | Current year susnpots | 11th April, 2022 | Text | |
Current quarter sunspots | Displays a graph of the current quarter sunspots | 11th April, 2022 | Example - popup | Zip |
Scripts free to use but please mention | www.newquayweather.com | |||
If you find the scripts useful to you, please consider making a donation | Thank you for your kind support |
Red Recent update
NOTE: 11/4/2022 - Fixed the pop up demo's and updated scripts with new background image urls
8/1/2014 download script totals include downloads from weather display forum before this page set up.
10th dec 2017 - Change url link to above in files, zips not updated
9th April 2017 - Minor change to 30 day graph and sunspots yesterdays total
I need to check other scripts
7th February 2015 - Added table script to sunspotsyear zip
5th February 2015 - Correction to current quarters graph and table scripts
16th January 2015 - Added year sunspot graph scripts
9th January 2015 - Update to 1700 to now script
Links
Forum Page for sunspot scriptsnewquayweather sunspot page
Script notes
sunspotsyest.phpDisplays sunspot number only, using file_get_contents, instructions in script new version 14-12-2014 has $ctx = stream_context_create(array('http' => array('timeout' => 10))); to overcome getting missing data error re slow internet connection, increase if you get errors. Does not require jpgraphs install
Example yesterdays total using script 148
cacheyest.txt -- leave as .txt
Cache file, upload to sunspots directory to, will update with new numbers, adjust $refetchSeconds =3600
to a lower figure like 10, once updated change back
sunspots30day.php
Displays the last 30 days as a graph, must have jpgraphs installed
Adjust settings to match your website location of jpgraphs cache file etc, place the script in your
wxgraphs directory
sunspots30T.php
Displays the last 30 days in a table, adjust path settings to match your website, place the script in your
sunspots directory. Does not require jpgraphs install
sunspots-year1700.php
This script displays a graph of mean sunspot numbers since 1700
Place in your wxgraphs directory you also need file yearssn.txt, put this in your sunspot directory, do not change .txt
9th Jan 2015 zip fixes the background image issue, choice of 3 backgrounds
A later update will save the manual update at end of year to yearssn.txt file
yearssn.txt
Data file for sunspots year 1700 to last year, this will need to be update manually start of new year
sunspots_cron_yr.php
This script is called by cron job everyday after swpc.noaa.gov update, you need to work out time difference, file uploaded
to their site around 0230 UTC. Set up cron in cPanel, example in script
Script fetches the data and adds the last day to a file so that a graph can be produced for the year.
Place script in sunspots directory.
sunspots-year.php
Produces year graph using the data supplied by the cron script above.
Put script in wxgraphs directory and amend settings to match your server.
Require up to date 2022_DSD.txt below
2022_DSD.txt
Up to date year sunspots text file, save as 2022_DSD.txt and place in sunspots/2022 directory, use
copy and paste, save as 2022_DSD.txt, put in sunspots/2022 directory
sunspotsTcyr.php
Displays the current years sunspots in a table, adjust path settings to match your website, place the script in your
sunspots directory.
sunspots-qtr.php
Produces current quarter graph
Put script in wxgraphs directory and amend settings to match your server.
Known issue start of new quarter no data
sunspotsTqtr.php
Displays the days in quarter in a table, adjust path settings to match your website, place the script in your
sunspots directory. This script requires sunspots-qtr.php installed to fetch data, might update to be standalone.