How to Begin Editing a Document in PHP

Navigating the editing of an online document can be a messy business; the inner nuances of the various formats can make manual modifications both slow and difficult. However, if you leverage our portfolio of document editing APIs, it can significantly simplify your task. The Begin Editing API is the first step in the editing process, and the focus of this tutorial. With this tool you can upload your document and create an editing URL that can be used for modifying the file.

To initiate our process, we will run this command to install the SDK:

Next, we will call the Begin Editing function with the following code:

// Configure API key authorization: Apikey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY');
$apiInstance = new Swagger\Client\Api\EditDocumentApi(


new GuzzleHttp\Client(),
$config
);
$input_file = "/path/to/inputfile"; // \SplFileObject | Input file to perform the operation on.
try {
$result = $apiInstance->editDocumentBeginEditing($input_file);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling EditDocumentApi->editDocumentBeginEditing: ', $e->getMessage(), PHP_EOL;
}
?>

This will return the aforementioned URL and open up the document for any editing functions you need to perform. To retrieve your free API key and gain access to this and other editing APIs, simply head to the Cloudmersive website to register for your free account.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store