Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($city))
- $curl = curl_init();
- $headers = array();
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($curl, CURLOPT_HEADER, 0);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_TIMEOUT, 30);
- $json = curl_exec($curl);
- curl_close($curl);
- $data = json_decode($json);
- if(!empty($data->list[0]->name)) {
- ?>
- <div>
- Stadt: <strong><?php echo $data->list[0]->name ?></strong><br />
- Aktuell:<strong><?php echo number_format($data->list[0]->main->temp - 273.15, 1, ',', '') ?> ° C </strong><br />
- Temperatur (heute): <br />
- min. <?php echo number_format($data->list[0]->main->temp_min - 273.15, 1, ',', '') ?> ° C<br />
- max. <?php echo number_format($data->list[0]->main->temp_max - 273.15, 1, ',', '') ?> ° C<br />
- Luftfeuchtigkeit: <?php echo number_format($data->list[0]->main->humidity)?> %<br />
- Windgeschwindigkeit: <?php echo $data->list[0]->wind->speed ?>m/s<br />
- Windrichtung: <?php echo $data->list[0]->wind->deg ?>°<br />
- Wolken: <?php echo $data->list[0]->clouds->all ?>%<br />
- Wetter: <?php echo $data->list[0]->weather->description ?><br />
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement