I have a vbs script on my local pc that I can run by double clicking on it. The scripts runs fine.
I have a php page that if requested tries to run the very same vbs script. Issue is that when my php runs it calls my vbs script and fails when it gets to a point where it needs to create an object.
How do I go about creating my object if I'm calling the vbs script from php.
PHP Code.
$command = 'wscript.exe C:/eClaimsAPI/SendToTelus.vbs';
/*
* wait for command to return a exit code?
*
* true = waits for the command to complete, before continuing this script
* false = executes command then continues this script without waiting for command to exit
*
*/
$wait = true;
// run it
$obj = new COM ( 'WScript.Shell' );
if ( is_object ( $obj ) )
{
$obj->Run ( 'cmd /C ' . $command, 0, $wait );
}
else
{
echo 'can not create wshell object';
}
$obj = null;
VBS Code
Dim nErr
Dim szXML
Dim strMsgType
Dim ID
Dim ID2
Dim oServer
Set TypeLib = CreateObject("Scriptlet.TypeLib")
ID = TypeLib.Guid
ID = Replace(ID,"{","")
ID = Replace(ID,"}","")
Set oServer = WScript.CreateObject("eCLaimsAPI.Api")
Issue happens on the last line where ( Set oServer )
Error: Could not create object named "eClaimsAPI.Api" Code: 80040154 Source: WScript.CreateObject