Dobra udało mi się ocdczytać plik xml
<?php
$weatherdata = simplexml_load_file('http://www.yr.no/place/Polen/Vest-Pommern/Choszczno/forecast.xml');
$name = $weatherdata->location->name;
$time = $weatherdata->forecast->tabular->time;
$symbol = $weatherdata->forecast->tabular->time->symbol;
$temperature = $weatherdata->forecast->tabular->time->temperature;
$windDirection = $weatherdata->forecast->tabular->time->windDirection;
$windSpeed = $weatherdata->forecast->tabular->time->windSpeed;
$pressure = $weatherdata->forecast->tabular->time->pressure;
?>
<style>
.temp {
background-color: #FEB100;
color: #fff;
font-family: arial;
font-size: 12px;
font-weight: bold;
padding-bottom: 3px;
padding-top: 3px;
padding-left: 6px;
padding-right: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
text-align: center;
}
.wiatr {
background-color: #464646;
color: #fff;
font-family: arial;
font-size: 12px;
font-weight: bold;
padding-bottom: 3px;
padding-top: 3px;
padding-left: 6px;
padding-right: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
text-align: center;
}
.cisnienie {
background-color: #e4e4e4;
color: #444;
font-family: arial;
font-size: 12px;
font-weight: bold;
padding-bottom: 3px;
padding-top: 3px;
padding-left: 6px;
padding-right: 6px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
text-align: center;
}
.data {
background-color: #f5f5f5;
color: #555;
font-family: arial;
font-size: 12px;
font-weight: bold;
padding-bottom: 3px;
padding-top: 3px;
padding-left: 5px;
padding-right: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border: 1px solid #e4e4e4;
width: 350px;
text-align: center;
}
.miejscowosc {
background-color: #2bb853;
color: #fff;
font-family: arial;
font-size: 12px;
font-weight: bold;
padding-bottom: 3px;
padding-top: 3px;
padding-left: 5px;
padding-right: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
text-align: center;
}
.tekst {
color: #fff;
font-family: arial;
font-size: 12px;
font-weight: bold;
padding-bottom: 3px;
padding-top: 3px;
padding-left: 8px;
padding-right: 8px;
text-align: center;
}
.brak {
padding-bottom: 3px;
padding-top: 3px;
padding-left: 4px;
padding-right: 4px;
text-align: center;
}
</style>
<?php
<tr>
<td class='miejscowosc'>$name</td>
<td class='tekst'>Prognoza na najbliższe godziny</td>
</tr>
</table>\n";
foreach ($weatherdata->forecast as $time) {
echo '<table border="0" cellpadding="0" cellspacing="0"> <tr>
<td></td>
</tr>
</table>';
echo '<table border="0" cellpadding="0" cellspacing="0" width="300px"> <tr><td>';
echo '<table border="0" cellpadding="0" cellspacing="0" width="60px"> <tr>
<td class="ikon"><img src="infusions/prognozy_panel/ikonki/'.$symbol['var'].'.png"</td>
</tr>
</table>';
echo '</td><td align="left">'; echo '<table border="0" cellpadding="0" cellspacing="5"> <tr>
<td class="temp">'.$temperature['value'].' ?C</td>
<td class="brak"> </td>
<td class="wiatr">'.$windSpeed['mps'].' m/s</td>
<td class="brak"> </td>
<td class="cisnienie">'.$pressure['value'].' hPa</td>
</tr>
</table>';
echo '</td></tr></table>'; }
?>
http://djdandi.nazwa.pl/1/2015/choszcznomini.phpBrak ikonki oznacza że nie ma jej na serwerze ale to nie problem
W bazie danych zmieniłem tabele i dałem na datę DATATIME
Co dalej jak dodać do tego możliwość zapisania danych w bazie sql?
Ten post edytował brzanek 25.08.2014, 19:55:53