Google Doc

A multipurpose module, plugin and component

Google Doc

New postby kotsch » Wed Feb 02, 2011 7:34 pm

For me it is not easy.
I have installed Jumi and created a Jumi Module to call a google document.
The document URL is:
https://docs.google.com/document/d/1kjX ... =de&pli=1#

The Module Code is:

<?php defined("_JEXEC") or die("Restricted access"); ?>
<?php
/* config */
$doc_url = 'https://docs.google.com/document/d';
$doc_id = '1kjX5Og8NbTSreX0_E0Gm4aV3UioEj3CdKdUhYrviH_k';
$cache_time = 30*24*60*60; // 30 days
$file_name = 'cache/'.md5($doc_id);

// check cache
if(file_exists($file_name) and strtotime('now') - filemtime($file_name) < $cache_time) {
echo file_get_contents($file_name);
} else {
// retrieve document from docs.google.com
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $doc_url.$doc_id);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$document = curl_exec($ch);
curl_close($ch);

/* modify document for inclusion */
// TODO

// cache article
if(strlen($wiki_content) < 3000) {
echo '<p>Unfortunately, no content could be extracted! ';
echo 'You can access document directly <a href="'.$doc_url.$doc_id.'" target="_blank">View Document</a></p>';
} else {
file_put_contents($file_name, $document);
echo $document;
}
}

Here is the URL to my site: http://fuassboi-in-ndb.de/svm/index.php ... &Itemid=21

As you can see the content could not be extracted. Can you help ?
kotsch
 
Posts: 1
Joined: Wed Feb 02, 2011 7:27 pm

Return to Jumi

Who is online

Users browsing this forum: No registered users and 4 guests