Google Doc
First unread post • 1 post
• Page 1 of 1
Google Doc
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 ?
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
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 8 guests