Skip to content

Instantly share code, notes, and snippets.

@berkocan
Last active November 28, 2021 21:23
Show Gist options
  • Save berkocan/70a9d396421bd4e5080527cc9cfd336d to your computer and use it in GitHub Desktop.
Save berkocan/70a9d396421bd4e5080527cc9cfd336d to your computer and use it in GitHub Desktop.
Hava Durumu (Api) Json Kodu | Hava Durumu Api
Hava durumunu json ile api olarak sitenize eklemek için aşağıdaki kodları kullanabilirsiniz. ▼☟↓
<?php
$JSON = json_decode(file_get_contents('https://api.genelpara.com/embed/hava-durumu.json'), true);
?>
<ul>
<li>
<span>İstanbul</span>
<span>Hava: <?php echo $JSON['istanbul']['hava']; ?></span>
<span>Sıcaklık: <?php echo $JSON['istanbul']['sicaklik']; ?></span>
</li>
<li>
<span>Ankara</span>
<span>Hava: <?php echo $JSON['ankara']['hava']; ?></span>
<span>Sıcaklık: <?php echo $JSON['ankara']['sicaklik']; ?></span>
</li>
<li>
<span>Sivas</span>
<span>Hava: <?php echo $JSON['sivas']['hava']; ?></span>
<span>Sıcaklık: <?php echo $JSON['sivas']['sicaklik']; ?></span>
</li>
<li>
<span>İzmir</span>
<span>Hava: <?php echo $JSON['izmir']['hava']; ?></span>
<span>Sıcaklık: <?php echo $JSON['izmir']['sicaklik']; ?></span>
</li>
<li>
<span>Kayseri</span>
<span>Hava: <?php echo $JSON['kayseri']['hava']; ?></span>
<span>Sıcaklık: <?php echo $JSON['kayseri']['sicaklik']; ?></span>
</li>
</ul>
GP. https://www.genelpara.com/api-kodu/
@returnednull
Copy link

Gorgeus work. Clean data. Good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment