Unprotect Documents (PHP REST)

Skip to end of metadata
Go to start of metadata
This example allows you to remove document protection from a document using Saaspose.Words REST API in your PHP applications.
Input document should be uploaded at Saaspose storage before running this example.

We're referring to the following common methods to perform general operations:

SaasposeApp::$AppSID  = "77*****************";
SaasposeApp::$AppKey = "89************8";
SaasposeApp::$OutPutLocation = getcwd() . "\\Output\\";

$inputDocument = "MainDocument.doc";
$password = "def";
$protectionType = "AllowOnlyComments";

$fieldsArray = array('Password'=>$password);
//Build JSON to post
$json = json_encode($fieldsArray);

//build URI
$strURI = 'http://api.saaspose.com/v1.0/words/' . $inputDocument . '/protection'; 

//sign URI
$signedURI = Utils::Sign($strURI);

Utils::processCommand($signedURI, "DELETE", "json", $json);

//build URI to download output file 
$strURI = 'http://api.saaspose.com/v1.0/storage/file/'. $inputDocument;
//sign URI
$signedURI = Utils::Sign($strURI);

$responseStream = Utils::processCommand($signedURI, "GET", "", "");
//save output file
$outputFile = SaasposeApp::$OutPutLocation . $inputDocument;
Utils::saveFile($responseStream, $outputFile);
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.