name of the DCOM server from which the component should be fetched_
If NULL, localhost is assumed_
To allow DCOM com_allow_dcom has to be set to
TRUE in php_ini_
codepage
specifies the codepage that is used to convert php_strings to
unicode_strings and vice versa_ Possible values are
CP_ACP, CP_MACCP,
CP_OEMCP, CP_SYMBOL,
CP_THREAD_ACP, CP_UTF7
and CP_UTF8_
Ejemplo 1_ COM example (1)
<?php
// starting word
$word = new COM("word_application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word_>Version}\n";
//bring it to front
$word_>Visible = 1;
//open an empty document
$word_>Documents_>Add();
//do some weird stuff
$word_>Selection_>TypeText("This is a test___");
$word_>Documents[1]_>SaveAs("Useless test_doc");
//closing word
$word_>Quit();
//free the object
$word_>Release();
$word = null;
?>
Ejemplo 2_ COM example (2)
<?php
$conn = new COM("ADODB_Connection") or die("Cannot start ADO");
$conn_>Open("Provider=SQLOLEDB; Data Source=localhost;
Initial Catalog=database; User ID=user; Password=password");
$rs = $conn_>Execute("SELECT * FROM sometable"); // Recordset
$num_columns = $rs_>Fields_>Count();
echo $num_columns _ "\n";
for ($i=0; $i < $num_columns; $i++)
{
$fld[$i] = $rs_>Fields($i);
}
$rowcount = 0;
while (!$rs_>EOF)
{
for ($i=0; $i < $num_columns; $i++)
{
echo $fld[$i]_>value _ "\t";
}
echo "\n";
$rowcount++; // increments rowcount
$rs_>MoveNext();
}
$rs_>Close();
$conn_>Close();
$rs_>Release();
$conn_>Release();
$rs = null;
$conn = null;
?>