-
-
Save mlncn/771654 to your computer and use it in GitHub Desktop.
by Pamela Fox, a tiny code snippet for using PHP to render published Google spreadsheets as HTML, which she ported from (Ported from her similarly tiny Python + App Engine version here: https://github.com/pamelafox/pamelafox-site/blob/master/main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Parsing this spreadsheet: https://spreadsheets.google.com/pub?key=0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc&hl=en&output=html | |
$url = 'http://spreadsheets.google.com/feeds/list/0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc/od6/public/values?alt=json'; | |
$file= file_get_contents($url); | |
$json = json_decode($file); | |
$rows = $json->{'feed'}->{'entry'}; | |
foreach($rows as $row) { | |
echo '<p>'; | |
$title = $row->{'gsx$title'}->{'$t'}; | |
$author = $row->{'gsx$author'}->{'$t'}; | |
$review = $row->{'gsx$review'}->{'$t'}; | |
echo $title . ' by ' . $author . '<br>' . $review; | |
echo '</p>'; | |
} | |
// See this here: http://imagine-it.org/google/spreadsheets/showspreadsheet.php | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment