Created
November 30, 2012 21:48
-
-
Save rewfergu/4178919 to your computer and use it in GitHub Desktop.
Import contents of a Google Doc into a page
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 | |
// Based on http://www.realisingdesigns.com/2009/10/29/using-google-docs-as-a-quick-and-easy-cms/ | |
// Specify document ID | |
$gd_doc = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; | |
$gd_array = array(); | |
$gd_array["url"] = "https://docs.google.com/document/pub?id=".$gd_doc; | |
$gd_array["start"] = '<div id="contents">'; | |
$gd_array["end"] = '<div id="footer">'; | |
$working_doc = file_get_contents($gd_array["url"]); | |
$gd_start = strpos($working_doc,$gd_array["start"]); | |
$gd_end = strpos($working_doc,$gd_array["end"]); | |
$gd_content = substr($working_doc, $gd_start, ($gd_end-$gd_start) ) | |
?> | |
<?=$gd_content?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment