PHP - Explain how to access a COM object from within my PHP page.

Explain how to access a COM object from within my PHP page.

To access COM object from PHP page, COM class can be made use of.
$obj = new COM("Application.ID")

Example:
<?php
// starting word
$ pad = new COM("pad.application") or die("Unable to instantiate pad ");
echo "Loaded Notepad, version {$ pad ->Version}\n";

//bring it to front
$ pad ->Visible = 1;

//open an empty document
$ pad ->Documents->Add();

//do some weird stuff
$ pad ->Selection->TypeText("This is a test...");
$ pad ->Documents[1]->SaveAs("Sample test.doc");

//closing word
$ pad ->Quit();

//free the object
$ pad = null;
?>

Explain how to access a COM object from within my PHP page.

The following is the process:

- Create an object of COM.
- Set the visibility of the file to 1
- Invoke the function Add() for creation of a document
- Insert the text into the document
- Save the file as the destination file
- Exit the process

The code is furnished here under.
<?
$word=new COM("word.application") or die("Cannot start word application");
print "The word version is ($word->Version)\n";
$word->visible =1;
$word->Documents->Add();
$word->Selection->Typetext("Sample_text");
$word->Documents[1]->SaveAs("samplefile.doc");
$word->Quit();
?>
PHP - Explain how to get the DNS servers of a domain name.
How to get the DNS servers of a domain name.....
PHP - Explain how to mail the content of a form.
Explain how to mail the content of a form - The HTML code can call the samplemail.php page and use the POST method to post the data.....
PHP - Explain how to send large amounts of emails with php.
Explain how to send large amounts of emails with php - The mail() function of PHP is quite robust for sending bulk emails...
Post your comment