I am using the PHP API 22.3 and using the sample code from the API documentation here:
However I keep getting the following error:
PHP Warning: Undefined array key "Content-Type" in /workspace/aspose/vendor/aspose-cloud/aspose-words-cloud/src/Aspose/Words/ObjectSerializer.php on line 112
When I usee a different APi function it works, e.g.
I have tested the sample code with the latest release of Aspose.Words Cloud SDK for PHP to insert a watermark into Word document and have been unable to notice any issues. Please use the latest release, it will resolve the issue.
PHP Sample Code to Add a Watermark in Word Document
<?php
require_once('D:\xampp\htdocs\aspose-words-cloud-php-master\vendor\autoload.php');
//TODO: Get your ClientId and ClientSecret at https://dashboard.aspose.cloud (free registration is required).
$ClientId="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx";
$ClientSecret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$wordsApi = new Aspose\Words\WordsApi($ClientId,$ClientSecret);
try {
$remoteDataFolder = "Temp";
$localFile = "C:/Temp/Sample.docx";
$outputFileName = "TestWaterMark.docx";
$requestWatermarkText = new \Aspose\Words\Model\WatermarkText(array(
"text" => "This is the text",
"rotation_angle" => 90.0,
));
$request = new Aspose\Words\Model\Requests\InsertWatermarkTextOnlineRequest(
$localFile,
$requestWatermarkText,
NULL,
NULL,
NULL,
NULL,
NULL
);
$result = $wordsApi->insertWatermarkTextOnline($request);
print_r($result);
} catch (Exception $e) {
echo "Something went wrong: ", $e->getMessage(), "\n";
PHP_EOL;
}
?>