[Solved] Trying to display Json data from a web url into a table


This is how i solved it

<?php
            try{
                $url="the json url goes here"; // path to your JSON file
                $data = file_get_contents($url); // put the contents of the file into a variable
                $characters = json_decode($data);
                echo '<div class="panel-heading">
            <h3 align="center">Market Prices for ';  echo $characters[0]->Crop;
                echo '</h3>
        </div>';
                echo '<div class="panel-body">
            <table class="table table-striped table-hover border" style="font-family: cambria">
                <thead>
                <tr>
                    <th>Market</th>
                    <th>Date</th>
                    <th>Price</th>
                </tr>
                </thead>
                <tbody>';
                foreach ($characters as $character) {
                    echo '<tr>';
                    echo '<td>' . $character->Market . '</td>';
                    echo '<td>' . $character->Date . '</td>';
                    echo '<td>' . $character->Price . '</td>';
                    echo '</tr>';
                }

                echo '</tbody>
        </table>
    </div>';
            }
            catch (Exception $e){
                echo '<p align="center">No Internet Connection, please try again</p>';
            }
            ?>

solved Trying to display Json data from a web url into a table