1

I need to call a dll that returns a string using PHP.
What would be the best possible way to achieve this?

ajreal
  • 44,929
  • 10
  • 81
  • 118
hitek
  • 352
  • 1
  • 15
  • 31

2 Answers2

2

Build a PHP extension that wraps the DLL or create a wrapper (in any language) that can be accessed via shell with exec.

rik
  • 8,341
  • 1
  • 22
  • 21
  • is there any other way to lets say initiate a service on the server and get the return using php? – hitek Dec 06 '10 at 16:59
-1

This is not possible using native PHP.

I would look into running an operating system level function to do this using exec(), like for example rundll.exe (for some kinds of DLLs).

If rundll can't do it (it has something to do with managed and unmanaged DLLs, I don't know what that means), the easiest way may be writing a wrapper application that imports the DLL, performs the necessary actions, and outputs the result.

Pekka
  • 418,526
  • 129
  • 929
  • 1,058