Skip to content

Instantly share code, notes, and snippets.


Created Mar 31, 2017
What would you like to do?
<head><title>Weather Report of <?php echo $_GET['q']; ?> -</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<script type="text/javascript" src=""></script>
html, body, h1, h2, h3, h4, h5, h6 {
font-family: "Comic Sans MS", cursive, sans-serif;
$get = json_decode(file_get_contents(''),true);
$city = $_GET['q'];
$string = "".$city."&units=metric&appid=ebcf5230b3446f334fe3fa2fd2d4ce24";
$data = json_decode(file_get_contents($string),true);
$temp = $data['main']['temp'];
$icon = $data['weather'][0]['icon'];
$visibility = $data['visibility'];
$visibilitykm = $visibility / 1000;
$country = "<h1 class='w3-xxxlarge w3-animate-zoom'><b>".$data['name'].",".$data['sys']['country']."</h1></b>";
$logo = "<center><img src='".$icon.".png'></center>";
$desc = "<b><p>".$data['weather'][0]['description']."</p></b>";
$temperature = "<b>Temp:".$temp."°C</b><br>";
$clouds = "<b>Clouds:".$data['clouds']['all']."%</b><br>";
$humidity = "<b>Humidity:".$data['main']['humidity']."%</b><br>";
$windspeed = "<b>Wind Speed:".$data['wind']['speed']."m/s</b><br>";
$pressure = "<b>Pressure:".$data['main']['pressure']."hpa</b><br>";
$visibility = "<b>Visibility:".$visibilitykm."Km</b><br>";
$sunrise = "<b>Sunrise:".date('h:i A', $data['sys']['sunrise'])."</b><br>";
$sunset = "<b>Sunset:".date('h:i A', $data['sys']['sunset'])."</b>";
<div class="w3-display-container w3-wide">
<img src="" style="width:100%;height:100%;" class="w3-image">
<div class="w3-display-topmiddle w3-margin-top">
echo $country;
echo $logo;
echo "<center><h2>".$desc."</h1></center>";
<div class="w3-display-middle w3-margin-top w3-padding-top">
<div class="w3-animate-left w3-margin-top"><br><br><br>
<h1 class="w3-xlarge">
<?php echo $temperature; ?>
<?php echo $clouds; ?>
<?php echo $humidity; ?>
<?php echo $$windspeed; ?>
<?php echo $pressure; ?>
<?php echo $$visibility; ?>
<?php echo $sunrise; ?>
<?php echo $sunset; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.