Hi,
We had a problem that we wanted our customers to review technical documentation but i didn't want them to have access to the system. The content of page is private so i couldn't put it on a public page.
Currently there is no option to link to a "private" viewing url that has visibilbe without logging in. So i created a simple script that exports a whole page (attachments and all) and put it in a folder.
It is some ugly coding but it works! just fill in your username, password, the space ID and the page title and you can export it.
<?php
$soapClient = new SoapClient(null, array(
"location" => "http://shopworks.atlassian.net/confluence/rpc/soap-axis/confluenceservice-v1?wsdl",
"uri" => "http://soap.rpc.confluence.atlassian.com",
"trace" => TRUE));
$soapClient = new SoapClient(
"http://shopworks.atlassian.net/confluence/rpc/soap-axis/confluenceservice-v2?wsdl"
,array("trace" => 1, "exceptions" => 0)
);
$token = $soapClient->login('username', 'password');
$name_document = 'Title of the document';
$name_space = 'TO';
$page = $soapClient->getPage($token,$name_space,$name_document);
$page2 = $soapClient->renderContent($token, $name_space, $page->id);
$attachments = $soapClient->getAttachments($token,$page->id);
foreach($attachments as $attachment){
$file = file_get_contents((string)$attachment->url.'&os_username=username&os_password=hk37K');
$dir = "/home/shopworks/www/wiki/download/attachments/".$page->id.'/';
if(!is_dir($dir)){
mkdir($dir, 0777);
chmod($dir, 0777);
}
file_put_contents($dir.$attachment->fileName, $file);
}
function niceName($name){
$name = str_replace(' ', '_', $name);
$name = strtolower($name);
return $name;
}
$str = str_replace('</style>',$style, $page2);
$str = str_replace('</body>',$footer, $str);
$newName = md5(time()).'-'.niceName($name).'.html';
file_put_contents($newName, $str);
chmod($newName, 0777);
echo 'http://www.shopworks.nl/customerpage/'.$newName;
?>
Hope somebody finds it as usefull as me.
Greetings Gijs
http://www.shopworks.nl