I googled how to call dll from php.
I found that I should use the COM extension to do this.
I followed some examples that use the COM to call the Internet Explorer application and othee applications .
$browser = new COM ("InternetExplorer.Application");
and run all these examples successsfuly.

But when I tried to call my dll which name is 'zkemkeeper.dll'
that have a class which name is 'CZKEMClass'
I registered it with regsvr32.exe successfully.
and I tried this code

<?php
com_load_typelib('zkemkeeper.CZKEMClass');
$obj = new COM("zkemkeeper.CZKEMClass") or die("Unable to create com object");
?>

I got this error:

Failed to create COM object zkemkeeper.CZKEMClass

If any one know what should I do please tell me.
Regarding that the DLL I want to call is not from my implementation.
I just need to use its functionality

I googled how to call dll from php.
I found that I should use the COM extension to do this.
I followed some examples that use the COM to call the Internet Explorer application and othee applications .
$browser = new COM ("InternetExplorer.Application");
and run all these examples successsfuly.

But when I tried to call my dll which name is 'zkemkeeper.dll'
that have a class which name is 'CZKEMClass'
I registered it with regsvr32.exe successfully.
and I tried this code

<?php
com_load_typelib('zkemkeeper.CZKEMClass');
$obj = new COM("zkemkeeper.CZKEMClass") or die("Unable to create com object");
?>

I got this error::icon_mad:
'Failed to create COM object `zkemkeeper.CZKEMClass'

If any one know what should I do please tell me.
Regarding that the DLL I want to call is not from my implementation.
I just need to use its functionality

I need something similar.... with the same dll file...

I try this:

[code=php]$com = new COM("DynamicWrapper");
$com->Register("KERNEL32", "Beep", "i=ll", "f=s", "r=l");
$com->Beep(800, 10);[/code]

coming from: http://ourworld.compuserve.com/homepages/Guenter_born/WSHBazaar/WSHDynaCall.htm

But i dont get anything whit zkemkeeper... only this:

Fatal error: Uncaught exception 'com_exception' with message 'Error [0x80070057]

Any help????

how to write the starting dll, and php code that will call the function at the dll function ?

any examples ?

thanks

Hey.

Sorry to say, I can't really help you with the loading of the DLLs into PHP. However, I can offer a suggestion as to how you can work around this problem.

PHP can execute shell commands, via the execution functions, so you could always write a wrapper-script around it using another language (or just a shell script), and then call it from PHP.

It's not ideal, but a possible fallback if all else fails.

Or, if you are really really desperate, you could always compile the code into PHP itself :-P (Don't ask me how to do that tho xD)

I'm having a similar problem.... Did you ever find a solution to it??
~AJ

you may make the dll visible by:
1. open the IDE project properties (here IDE I used is Visual studio 2008)
2. select the first tab "Application"
3. click "Assemberly Information" and a dialogue show up
4. enable "COM-Visible" and press [OK]
5. recompile your DLL
Hope these message helpful

Urline/Charlie, PMP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.