- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
<?php
$urlcontent=file_get_contents("http://services.swpc.noaa.gov/text/3-day-solar-geomag-predictions.txt");
$smm[1]=0;
$smm[2]=0;
$smm[3]=0;
$smm[4]=0;
$smm[5]=0;
$smm[6]=0;
for ($j=0; $j<24; $j=($j+3)){
$rgs = "~High\/".swt($j)."UT\s{1,}(\d{1,2})\s{1,}(\d{1,2})\s{1,}(\d{1,2})\n~";
preg_match($rgs,$urlcontent,$ball);
$smm[1]=$smm[1]+$ball[1];
$smm[2]=$smm[2]+$ball[2];
$smm[3]=$smm[3]+$ball[3];
if ($smm[4]<$ball[1]) $smm[4]=$ball[1];
if ($smm[5]<$ball[2]) $smm[5]=$ball[2];
if ($smm[6]<$ball[3]) $smm[6]=$ball[3];
}
$smm[1]=$smm[1]/8;
$smm[2]=$smm[2]/8;
$smm[3]=$smm[3]/8;
$rgs = "~Mid/Minor_Storm\s{1,}(\d{1,2})\s{1,}(\d{1,2})\s{1,}(\d{1,2})\n~";
preg_match($rgs,$urlcontent,$ball1);
$rgs = "~High/Minor_Storm\s{1,}(\d{1,2})\s{1,}(\d{1,2})\s{1,}(\d{1,2})\n~";
preg_match($rgs,$urlcontent,$ball2);
$result = '<table BORDER=1>
<tbody>
<tr>
<td>February 25 </td>
<td>February 26 </td>
<td>February 27 </td>
</tr>
<tr>
<td>'.$smm[4].'<br> Max Kp </td>
<td>'.$smm[5].'<br> Max Kp </td>
<td>'.$smm[6].'<br> Max Kp </td>
</tr>
<tr>
<td>
Prob-M '.$ball1[1].'%<br>
Prob-H '.$ball2[1].'%
</td>
<td>
Prob-M '.$ball1[2].'%<br>
Prob-H '.$ball2[2].'%
</td>
<td>
Prob-M '.$ball1[3].'%<br>
Prob-H '.$ball2[3].'%
</td>
</tr>
</tbody>
</tabbe>';
echo $result;
//$resp = json_encode($result);
//echo $resp;
// ---functions ---------
...
наговнокодил лично чтоб в табличном виде представлять данные и текстового файла