COM
COM class
$obj = new COM("server.object")
Description
The COM class provides a framework to integrate (D)COM components into
your php scripts.
Methods
stringCOM::COM
stringmodule_name
stringserver_name
intcodepage
COM class constructor. Parameters:
module_name
name or class-id of the requested component.
server_name
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.
COM example (1)
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;
]]>
COM example (2)
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;
]]>