forked from hannonhill/Webservices-PHP-Sample-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
move.php
46 lines (40 loc) · 1.03 KB
/
move.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
42
43
44
45
46
<?php
// Move/Rename an asset
$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'
);
$destFolderIdentifier = array
// Optional if you're renaming not moving
(
'id' =>'Your-New-Folder-ID',
'type' => 'folder'
);
$moveParams = array
(
'authentication' => $auth,
'identifier' => $identifier,
'moveParameters' => array
(
// Must specify a new name and/or new container for the asset - only one is required
'destinationContainerIdentifier' => $destFolderIdentifier,
'newName' => 'New-Page-Name',
// Required: true or false
'doWorkflow' => false,
)
);
$reply = $client->move($moveParams);
if ($reply->moveReturn->success=='true')
echo "Success.";
else
echo "Error occurred when moving/renaming: " . $reply->moveReturn->message;
?>