Home > Article > Backend Development > PHP4 support for WindowsCOM_PHP tutorial
On Windows platforms, PHP4 now supports COM.
This means that PHP4 can actually operate all Windows applications.
The COM module at the heart of Microsoft allows any Windows application to
provide a certain number of components and other methods as an entry point for manipulating another
application.
A few lines of short code may be more effective than a detailed description. Next, let's take a look at an example of
: it starts Word, creates a new document, adds text and saves it to disk.
$word = new COM("word.application") or die("Impossible to instantiate WordApp");
print "Word is running, version {$word-> Version}n";
$word->Visible=1;
$word->Documents->Add();
$word->Selection->TypeText("This is a test ...");
$word->Documents[1]->SaveAs("test_com_php.doc");
$word->Quit();
?>