ソースコード

<?php
$tmp_url 
"http://weather.livedoor.com/forecast/webservice/json/v1?city=340010";
$json file_get_contents$tmp_url ) or die("Failed to get json");
$json mb_convert_encoding$json'UTF8''ASCII,JIS,UTF-8,EUC-JP,SJIS-WIN' );
$obj json_decode($json);

$title $obj->title;

$description =  $obj->description->text;

//today
$today $obj->forecasts[0]->date;
$today_telop $obj->forecasts[0]->telop;
$today_img_url $obj->forecasts[0]->image->url;

//tommorow
$tomorrow $obj->forecasts[1]->date;
$tomorrow_telop $obj->forecasts[1]->telop;
$tomorrow_img_url $obj->forecasts[1]->image->url;
$tomorrow_minT $obj->forecasts[1]->temperature->min->celsius;
$tomorrow_maxT $obj->forecasts[1]->temperature->max->celsius;

?>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>天気予報</title>
<style>
body{ line-height: 200%;}
div.code{ border: 1px solid gray; border-radius: 3px; padding: 1em; }
</style>
</head>
<body>
<h1><?php echo $title;?></h1>
<p><?php  echo $description?></p>
<ul>
<li> 今日の日付: <?php echo $today;?>
<li> 今日の天気: <?php echo $today_telop?>
<li> 今日の天気画像: <?php echo "<img src='".$today_img_url."'>"?>

<li> 明日の日付: <?php echo $tomorrow;?>
<li> 明日の天気: <?php echo $tomorrow_telop ?>
<li> 明日の天気画像: <?php echo "<img src='".$tomorrow_img_url."'>"?>
<li> 明日の最高温度: <?php echo $tomorrow_maxT?>
<li> 明日の最低温度: <?php echo $tomorrow_minT?>
</ul>


<h3>ソースコード</h3>
<div class="code">
<?php show_source("weather.php");?>
</div>

</body>
</html>