我可以访问系统上名为sstchca.DLL的DLL,该DLL提供了访问Siebel Business Layer的功能。我能够在Excel中引用DLL并编写VBA程序来执行功能。以下是执行连接的VBA代码示例:
Private Function CreateConn(strConnect As String, strEnterprise As String, strPort As String, strPass As String) As Boolean
Dim errCode As Integer
Dim errText As String
Dim SiebelApp As SiebelDataControl
Set SiebelApp = CreateObject("SiebelDataControl.SiebelDataControl.1")
CreateConn = True
SiebelApp.Login "host=""siebel://" & strConnect & ":" & strPort & "/" & strEnterprise & "/EAIObjMgr_enu""", _
"sadmin", strPass
errCode = SiebelApp.GetLastErrCode()
If errCode <> 0 Then
errText = SiebelApp.GetLastErrText
CreateConn = False
Exit Function
我们正在研究在PHP中访问相同COM接口的可行性,我不确定从哪里开始?
有人能帮我一些在PHP中建立COM连接的示例代码吗?以上面的VBA代码为基础,或者为我指出一些PHP COM的好例子的正确方向?
我尝试将VBA代码转换为PHP代码,结果如下:
<?php
function CreateConn($strConnect, $strEnterprise, $strPort, $strPass) {
global $errText;
$SiebelApplication = new COM('SiebelDataControl.SiebelDataControl.1') or die("Unable to instantiate SiebelDataControl");
$ConnStr = "host="siebel://".$strConnect.":".$strPort."/".$strEnterprise."/EAIObjMgr_enu"";
$SiebelApplication->Login($ConnStr, "sadmin", $strPass);
$errCode = $SiebelApplication->GetLastErrCode();
if ($errCode != 0) {
$errText = $SiebelApplication->GetLastErrText();
return false;
} else {
return true;
}
}
?>
Siebel软件没有安装在我的系统上,所以我不能说这段代码是否真的有效,但我希望它能成为一个起点。