wetterdaten-json-mit-php-komplette-api-auslesen-schleife.php


Quell Code


<!doctype html>
<html lang="de">
  <head>
  <title>Wetterapi mit php</title>
  <style>
  table{
    width:80vw;
    margin:0 auto;
    border-collapse:collapse;
  }
  td,th{
    border:1px solid black;
  }
  </style>
</head>
<body>
  <h1>Komplette Api auslesen</h1>
  <table>
    <thead>
      <tr><th>Key</th><th>Value</th></tr>
    </thead>
    <tbody>
    <?php
    $json=file_get_contents('https://api.weatherlink.com/v1/NoaaExt.json?user=001D0A00DE6A&pass=DEMO&apiToken=demo0a002bc5272033001d0a002bc527?format=jsonp&callback=DisplayTaupunkt');
    $jsonIterator = new RecursiveIteratorIterator(
        new RecursiveArrayIterator(json_decode($json, TRUE)),
        RecursiveIteratorIterator::SELF_FIRST);
    foreach ($jsonIterator as $key => $val) {
        if(!is_array($val)) {
             echo "<tr><td>$key</td><td>$val</td></tr>";
        }
    }
    ?>
    </tbody>
  </table>
</body>
</html>


Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0