K8055 calling functions from PHP?

Hi all, recieved my usb interface card thismorning (VM110) as part of an experimental project. I want to be able to call the dll functions to control the card using PHP. I’ve seen it has been done using linux and an executable, but I am using apache/php on a windows machine. Been googling like mad and straight away found the COM functions for php on windows, but I haven’t the foggiest what to do with it. I’ve basically learnt that the first thing you do with the COM function is as follows: $blahblah = com();

The PHP manual states “can be a ProgID, Class ID or Moniker that names the component to load. A ProgID is typically the application or DLL name, followed by a period, followed by the object name. e.g:”

So what exactly would I put in com() to get it to work? Whatever I try I get a nasty php error:

Fatal error: Uncaught exception ‘com_exception’ with message ‘Failed to create COM object `K8055D’: Invalid syntax ’ in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php:54 Stack trace: #0 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php(54): com->com(‘K8055D’) #1 {main} thrown in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\index.php on line 54

I’ve tried using REGSVR32 K8055D in cmd, but get this error aswell: “k8055d was loaded, but the DllRegisterServer entry point was not found”

I’m guessing there’s a lot more to it than this, as it seems too simple to be true…

Hopefully someone can steer me in the right direction :slight_smile:

Thanks

K8055D.DLL is not a COM DLL, therefore the file cannot be registered or used as a COM object.
The K8055D.DLL is a Windows DLL then it does not need to be registered.

Found this:
[color=#000080]"1. I have built a DLL to calculate something. Is there any way to run this DLL under PHP ?
If this is a simple DLL there is no way yet to run it from PHP.
If the DLL contains a COM server you may be able to access it if it implements the IDispatch interface. "[/color]

http://www.php.net/manual/en/faq.com.php

BTW:
Here is the link to download the latest software package for the K8055:
velleman.eu/downloads/files/ … rsion4.zip

Pleas read the “README.TXT” and the “K8055 & VM110 Getting Started.pdf”.

Thanks. Shortly after posting that I found out that I couldn’t use the com() function, like you said. So i’m coming at it from another angle. I have the dev-c++ example source code and i’m going to try and connect to an sql database from within the program, and then control the card depending on values in the database. Not had much luck with that yet, but I won’t stop trying :neutral_face:

Hi,
We have quite a good experience in managing K8055 using JavaScript and PHP.
You can look at how we manage Velleman KSR10 robotic arm with K8055 USB board in our remote lab.
:arrow_right: remote-lab.fyzika.net/experiment-3.php?lng=en
JavaScript (AJAX) according to the event (mouse click, etc.) call the PHP script that communicates using TCP with K8055 Control Server (written in Pascal with the DLL)
JavaScript (AJAX) could communicate directly with the control server, but PHP will supply the necessary security.
Now I’m trying a general control server (ver 0.0.1), which can be controlled by the above method. Javascript (AJAX) send all the standard features of the K8055 DLL (OutputAnalogChannel, ClearAllAnalog … etc).
Our IT manager is very lazy :imp: and has made no provision for our school network. We can therefore run only one task.
I can disconnect my a robotic arm and prepare a general server for remote demonstration. [color=#FF0000]If you are interested[/color]. (But it will be until after Easter)

[quote=“Remote-Lab GymKT”]Hi,
We have quite a good experience in managing K8055 using JavaScript and PHP.
You can look at how we manage Velleman KSR10 robotic arm with K8055 USB board in our remote lab.
:arrow_right: remote-lab.fyzika.net/experiment … JavaScript (AJAX) according to the event (mouse click, etc.) call the PHP script that communicates using TCP with K8055 Control Server (written in Pascal with the DLL)[/quote]

That looks very cool.

Does this also let you read digital/analog inputs of the card and if yes, what is it practical interval you get in a LAN environment? From here in Pennsylvania, I have 125ms ping round trip to your server, so I couldn’t possibly get more than 8 PHP requests per second done. Unless sending the input status is implemented as a multi-part document with server-push.

For a real application, that isn’t controlled by guest users from a browser, installing OpenVPN or using an ssh tunnel would be an alternative.