开发者

Strategies for Accessing a Application with a COM API From PHP

开发者 https://www.devze.com 2022-12-23 14:54 出处:网络
Background: Experienced PHP developer with a mostly *nix background. I\'m writing a PHP application that needs to interact with a proprietary 3rd party system.The 3rd party system is Windows only.The

Background: Experienced PHP developer with a mostly *nix background.

I'm writing a PHP application that needs to interact with a proprietary 3rd party system. The 3rd party system is Windows only. The PHP application will be living on a separate Linux based system

The 3rd party application has been described as having a "COM API" that I'll need to talk to from the PHP application. What does this look like architecturally speaking? I'm starting with the COM section of the PHP manual, but I have specific questions.

Specific Questions:

  1. Can I talk directly to a COM API from a PHP application running on another server? If so, how? (what PHP extensions would I need, or what protocols/PHP functions would I be using to talk to the API)

  2. If the answer to number 2 is no, I'd assume I'd need some kind of application on the Windows machine that can 开发者_高级运维talk to COM, and then a service on the windows machine I can hit with PHP. Are there prebuilt frameworks for this kind of thing?

  3. Is this all nonsense and/or did I say something exceedingly stupid? (Quite possible, as I'm a little fuzzy on what "COM" does and doesn't cover)

I'm obviously not looking for a full solution here, I'm just trying to get a general idea of what is and isn't possible and what kind of things I'll want to Google for.

Thanks!


Normally a "COM API" is contained in a DLL file or Active X control(kinda like a dll file) and you reference that from a windows application which will load the COM dll just like any other DLL. COM was really just an attempt at making DLLs easier to reuse as well as address many other issues with DLLs.

So the answer to number 1 is no. The answer to number 2 is yes. I would personally create a wrapper for the COM API with WCF. WCF is basically a Microsoft .NET technology for building web services. This would make consuming the api in PHP much easier. The biggest hurdle will be learning WCF as well as figuring out how you want to map members in the COM api to members in your web service, since the data types will probably need to be transformed in some way. The WCF application can be hosted as a windows service or hosted in IIS, so this sort of kills both birds in one stone.

You could optionally use the older Web Services in .NET that have been around before WCF, I just personally liked WCF better because it was more flexible. If you click enough times through the microsoft's extremely user unfriendly webcast site you can download a series of videos on WCF: http://www.dasblonde.net/2007/06/24/WCFWebcastSeries.aspx

-3 No I don't think so.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号