-
Notifications
You must be signed in to change notification settings - Fork 13
/
publish.php
41 lines (34 loc) · 1.1 KB
/
publish.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
// Publish a page or file
$soapURL = "http://localhost:8080/ws/services/AssetOperationService?wsdl";
$client = new SoapClient
(
$soapURL,
array ('trace' => 1, 'location' => str_replace('?wsdl', '', $soapURL))
);
$auth = array ('username' => 'admin', 'password' => 'admin' );
$identifier = array
(
// ID or path of the asset
'id' =>'Your-Page-ID-Here',
'type' => 'page'
);
$destinationIdentifier = array
(
// ID or path of the destination
'id' => 'Your-Destination-ID-Here',
'type' => 'destination'
);
$publishInformation = array
(
'identifier' => $identifier,
'destinations' => array ($destinationIdentifier), // This is optional, not providing this will result in publishing to all enabled destinations available to authenticating user
'unpublish' => false // This is optional, default is false
);
$publishParams = array ('authentication' => $auth, 'publishInformation' => $publishInformation);
$reply = $client->publish($publishParams);
if ($reply->publishReturn->success=='true')
echo "Success: Published.";
else
echo "Error occurred when publishing: " . $reply->publishReturn->message;
?>