Free Support Forum - aspose.cloud

Convert DOC to DOCX in PHP with Aspose.Words Cloud SDK for PHP

Hi,

I’ve tried to run the my first code in numerous ways for the last two days but no matter what I tried, I could not run it. So, here I’m.
I downloaded and installed the Aspose.Words-Cloud-SDK-for-PHP package with composer in the same directory with my php code.

After that I added following code (which I copied from documentation) into my php file:

$inputPath = getcwd() . “/TSG.doc”;
$fileName = basename($inputPath);
$outputPath = getcwd() . “/MyOutputFile1.docx”;
$appSID = “1b25*************”;
$appKey = “dca95************”;
$save_format = “docx”;
$strURI = “http://api.aspose.com/v1.1/words/convert?format=” . $save_format;
$signedURI = Sign($strURI, $appSID, $appKey);
$responseStream = uploadFileBinary($signedURI, $inputPath, ‘xml’);
saveFile($responseStream, $outputPath);

Note: I used complete appSID and appKey, not the above ones.

In the end, the only output I could get is the following message:
Fatal error: Call to undefined function Sign() in D:\XAMPP\htdocs\Login\new.php on line 75

I supposed that I should have added a require (or require_once) line at the beginning of my code because the “sign()” function propably belongs to Aspose API. So, I included all of api files in package into my “require” line, one by one. After that, I tried other packages, examples, etc from github and various combinations. Nothing has changed. I’ve received the same error message.

I miss something (or more) but what?

Which package should I download and where should I install it?
In my php code, how should I refer to Aspose API?
Do I ask wrong questions or is there any other question which I forget to ask?

Thanks in advance…


Hi Arhan,

Common methods like sign and uploadFileBinary are present inside Utils class. You can call them with reference to Utils e.g. Utils::sign

Please also check the tests folder at Aspose.Words Cloud SDK for PHP where a few tests are available for each API.

Best Regards,