Skip to content

Instantly share code, notes, and snippets.

@rdlagency
Last active June 23, 2022 10:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rdlagency/dcabc504316f08506350cb31cce0c3c3 to your computer and use it in GitHub Desktop.
Save rdlagency/dcabc504316f08506350cb31cce0c3c3 to your computer and use it in GitHub Desktop.
<?php
// This was a quick proof of concept from 2009, use the script freely - https://www.realisingdesigns.com/web-design-articles/using-google-docs-quick-easy-cms/
// Specify document
$gd_doc = "dd9zpc9r_4jh8qv76j";
$gd_doc_type = "doc";
$gd_array = array();
$gd_array["doc"]["url"] = "http://docs.google.com/View?id=".$gd_doc;
$gd_array["doc"]["start"] = '&lt;div id="doc-contents"&gt;';
$gd_array["doc"]["end"] = '&lt;div id="google-view-footer"&gt;';
$working_doc = file_get_contents($gd_array[$gd_doc_type]["url"]);
$gd_start = strpos($working_doc,$gd_array[$gd_doc_type]["start"]);
$gd_end = strpos($working_doc,$gd_array[$gd_doc_type]["end"]);
$gd_content = substr($working_doc, $gd_start, ($gd_end-$gd_start) );
// Output
echo $gd_content;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment