. X-Ray data (GOES) 5 minute: http://www.swpc.noaa.gov/Data/goes.html WWV data: ftp://ftp.swpc.noaa.gov/pub/latest/wwv.txt fixed, only ftp access Flux data: ftp://ftp.swpc.noaa.gov/pub/latest/DSD.txt fixed, only ftp access Particle data: http://www.swpc.noaa.gov/ftpdir/lists/particle/Gp_part_5m.txt ftp://ftp.swpc.noaa.gov/pub/lists/particle/Gp_part_5m.txt Neutron data: http://www.bartol.udel.edu/~takao/neutronm/glealarm/ seems ok, including neutron code below New proton: https://services.swpc.noaa.gov/json/goes/primary/integral-protons-6-hour.json Defunct Example X-Ray data :-( 2012 03 28 1350 56014 49800 9.32e-09 3.05e-07 3.05e-02 37 49 Defunct Example particle data # YR MO DA HHMM Day Day P > 1 P > 5 P >10 P >30 #----------------------------------------------------------------------- 2012 07 11 1425 56119 51900 8.16e+00 6.51e-01 2.17e-01 5.67e-02 55 65 Neutron Monitor... we will look for: Now Quiet */ // Change these configuration strings as required // When called from cron, complete paths may be required $path = '/home/vp9kf/public_html/w4/sun/'; $findit = $path.'wwv.txt'; $putit = $path.'wwv_last.txt'; if (filesize($findit) == 0) { exit; } if (!copy($findit,$putit)) { $errormsg = "WARNING: wwv.txt wasn't copied"; } if (filesize($path.'dsd.txt') == 0) { exit; } if (filesize($path.'xray.txt') == 0) { exit; } $wwvlines=file($path.'wwv.txt'); $dsdlines=file($path.'dsd.txt'); $xraylines=file($path.'xray.txt'); $particlelines=file($path.'particles.txt'); $neutronlines=file($path.'neutrons.txt'); $newfile=($path.'latest_wwv.txt'); $logfile=($path.'wwv_log.txt'); $lastwwv=($path.'wwv_previous.txt'); $localkp=($path.'localkpstatus.gif'); $localx=($path.'localxstatus.gif'); $localp=($path.'localpstatus.gif'); $localn=($path.'localnstatus.gif'); $find1='Solar flux'; $find2='The estimated planetary K-index'; $find3='Now'; $outfile=fopen($newfile,"w+"); $logoutfile=fopen($logfile,"a+"); $lastoutfile=fopen($lastwwv,"r+"); foreach($wwvlines as $ll) { if (strstr($ll,$find1)) { list($a,$b,$flux,$c,$d,$e,$f,$aindex)=explode(" ", $ll); //Solar flux 73 and estimated planetary A-index 1. if (strstr($aindex,'A-Index')) { $aindex=$f; } $aindex = substr($aindex,0,-2); } if (strstr($ll,$find2)) { list($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$kindex)=explode(" ", $ll); //The estimated planetary K-index at 1500 UTC on 01 February was 1. $kindex=substr($kindex, 0, -2); $kindex=ltrim($kindex); $kindex=rtrim($kindex); } } foreach($dsdlines as $dl) { } $ssn=substr($dl,19,3); if ((substr($ssn,0,1))===" ") { $ssn=substr($ssn,1,2); } // was 1.00e-12, missing=-1.00e+05 $xindex='1.00e-12'; foreach($xraylines as $xl) { $xindextmp=substr($xl,-170); echo ':xindextmp='.$xindextmp.':'; $tail=strstr($xindextmp,'flux": '); $tail1=strstr($tail,',',true); echo ':tail='.$tail1.':'; //get rid of first seven chars; //echo substr('abcdef', 1); // bcdef $xindextmp=substr($tail1,7); echo ':tail='.$xindextmp.':'; if (is_numeric($xindextmp)) { if ($xindextmp >= $xindex) { $xindex = $xindextmp; } } } echo ':xindex='.$xindex.':'; foreach($particlelines as $pl) { $pindextmp=substr($pl,-686); echo ':pindextmp='.$pindextmp.':'; $ptail=strstr($pindextmp,'flux": '); $ptail1=strstr($ptail,',',true); echo ':ptail='.$ptail1.':'; //get rid of first seven chars; //echo substr('abcdef', 1); // bcdef $pindextmp=substr($ptail1,7); echo ':tail='.$pindextmp.':'; if (is_numeric($pindextmp)) { if ($pindextmp >= $pindex) { $pindex = $pindextmp; } } } echo ':pindex='.$pindex.':'; $nflag=0; foreach($neutronlines as $nl) { if ($nflag===1) { $nindex=strip_tags($nl); break; } if (strstr($nl,$find3)) { $nflag=1; } } $nindex=ltrim($nindex); $nindex=rtrim($nindex); $nindex=strtolower($nindex); $fin='F:'.$flux.' A:'.$aindex.' K:'.$kindex.' SSN:'.$ssn; $dandt=date('Y-m-d H:i:s'); fputs($outfile,$fin); $fin_fin=$dandt.chr(32).$fin.chr(13).chr(10); $end_new=substr($fin_fin,20); // $old=fgets($lastoutfile); // rewind($lastoutfile); // $end_old=substr($old,20); // if ($end_new!=$end_old) { fputs($logoutfile,$fin_fin); } fputs($lastoutfile,$fin_fin); fclose($lastoutfile); fclose($logoutfile); fclose($outfile); echo ':kindex='.$kindex.':'; $imagekp=$path.'kp'; if (($kindex==0) or ($kindex==1)) { $imagekp.='quiet'; } if ($kindex==2) { $imagekp.='unsettled'; } if ($kindex==3) { $imagekp.='active'; } if ($kindex==4) { $imagekp.='minorstorm'; } if ($kindex==5) { $imagekp.='majorstorm'; } if ($kindex>5) { $imagekp.='severestorm'; } $imagekp.='.gif'; echo $imagekp.':'.$localkp; if (!copy($imagekp,$localkp)) { $errormsg = "WARNING: local kp file wasn't copied"; echo $errormsg; } $imagex=$path.'x'; // $imagex.='data'; if ($xindex<1e-9) { $imagex.='normal'; } if (($xindex>=1e-9) and ($xindex<1e-8)) { $imagex.='active'; } if (($xindex>=1e-8) and ($xindex<1e-7)) { $imagex.='a'; } if (($xindex>=1e-7) and ($xindex<1e-6)) { $imagex.='b'; } if (($xindex>=1e-6) and ($xindex<1e-5)) { $imagex.='c'; } if (($xindex>=1e-5) and ($xindex<1e-4)) { $imagex.='m'; } if (($xindex>=1e-4) and ($xindex<1e-3)) { $imagex.='x'; } if (($xindex>=1e-3) and ($xindex<1e-1)) { $imagex.='mega'; } $imagex.='.gif'; echo ':imagex='.$imagex.':'; copy($imagex,$localx); echo ':LOCALX='.$localx.':'; // proton bit $imagep=$path.'p'; // $imagep.='data'; if ($pindex<1e-1) { $imagep.='quiet'; } if (($pindex>=1e-1) and ($pindex<1e0)) { $imagep.='normal'; } if (($pindex>=1e0) and ($pindex<1e1)) { $imagep.='unsettled'; } if (($pindex>=1e1) and ($pindex<1e2)) { $imagep.='warning'; } if (($pindex>=1e2) and ($pindex<1e3)) { $imagep.='extreme'; } $imagep.='.gif'; echo ':imagep='.$imagep.':'; copy($imagep,$localp); echo ':LOCALP='.$localp.':'; //neutron bit $imagen=$path.'n'.$nindex.'.gif'; echo ':imagen='.$imagen.':'; copy($imagen,$localn); echo ':LOCALN='.$localn.':'; ?>