Skip to content

Instantly share code, notes, and snippets.

@udithishara
Forked from rilinweb/example.html
Created November 16, 2015 12:09
Show Gist options
  • Select an option

  • Save udithishara/4b606f15ceecf9dab01c to your computer and use it in GitHub Desktop.

Select an option

Save udithishara/4b606f15ceecf9dab01c to your computer and use it in GitHub Desktop.

Revisions

  1. @rilinweb rilinweb created this gist Apr 22, 2015.
    38 changes: 38 additions & 0 deletions example.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    <?php
    $spreadsheetID = '1pO7BBOkhWL2TcBPYkDTlWZ0Gbw4mAUSadK_8NOn0Ij8';
    $urlPath = 'http://spreadsheets.google.com/feeds/list/' . $spreadsheetID . '/od6/public/values?alt=json';
    $file = file_get_contents($urlPath);
    $json = json_decode($file);
    $rows = $json->{'feed'}->{'entry'};
    ?>
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Get Google Spreadsheet Data</title>
    <link rel="stylesheet" href="http://yandex.st/bootstrap/3.3.0/css/bootstrap.min.css">
    </head>
    <body>

    <div class="container">
    <div class="page-header">
    <h1>Get Google Spreadsheet Data Example</h1>
    <p>See article <a target="_blank" href="http://rilin.ru/poluchaem-dann…le-i-vyvodim-i/">here</a></p>
    </div>

    <?php foreach ($rows as $row): ?>
    <div class="jumbotron">
    <h1>
    <?php echo $row->{'gsx$title'}->{'$t'}; ?>
    </h1>
    <h2>
    <?php echo $row->{'gsx$subtitle'}->{'$t'}; ?>
    </h2>
    <?php echo $row->{'gsx$description'}->{'$t'}; ?>
    </div>
    <?php endforeach; ?>

    </div>

    </body>
    </html>