Export a confluence page for client review (no login required)


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.

$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(
    ,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.'/';
       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


2 answers

0 votes
Gary Sackett Atlassian Team Jan 16, 2013

Hi Gijs,

Nice work on this - what format does the page get saved as locally? Our Support Staff will proably link this as a posssible workaround for other users - again, great work.



Hi Gary,

Thank you, the format is html. When you use this with other plugins like Balsamiq or Gliffy you will have some problemns viewing.

But this is our latetst version with a nice template:


Greetings Gijs

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

63 views 3 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you