Question

I have access to DLL named sstchca.dll on my system that provides functions to access Siebel Business Layer. I am able to reference the DLL in Excel and write VBA Programs to perform function. Here is the Sample VBA Code performing the connection:

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

We are looking at feasibility of accessing the same COM interface in PHP and I am not sure where to start?

Can anybody help me some example code of establishing COM connection in PHP keeping the above VBA code as basis or point me to the right direction for some good examples for PHP COM?

Was it helpful?

Solution

I've tried to translate your VBA code to PHP code, and here is the result:

<?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;
    }
}

?>

The Siebel software is not installed on my system, so I can't say if this code really works, but I hope it can be a starting point.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top