473,563 Members | 2,767 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP to a COM object

Hello,

I'm trying to use a (remote) COM object from a PHP script (4.4, server has
apache2 win32).

The basics seem to work : I instantiate the COM object ($o = new COM"..."),
then I use two of the objects methods to authenticate. In the meantime a
property called "ProjectConnect ed", passes from 0 to 1. So I think the
object is correctly instanciated and the connection works.

But now, I'm doing a var_dump on my object and I get this :
object(COM)(1) {
[0]=resource(127) of type (COM)
}

Arg. I don't understand this and the PHP manual doesnt help either. I would
have expected to get a list of methods/properties. At least the two I use to
authenticate.

var_dump ($obj[0]) returns null.
Could someone explain me more about this ?

Thanks,
--
Alex
[JDR] Visitez Extremia, un monde gratuit et en francais pour D&D et
autres jeux de role.
www.extremia.org
Nov 14 '07 #1
16 2077
Alex wrote:
Hello,

I'm trying to use a (remote) COM object from a PHP script (4.4, server has
apache2 win32).

The basics seem to work : I instantiate the COM object ($o = new COM"..."),
then I use two of the objects methods to authenticate. In the meantime a
property called "ProjectConnect ed", passes from 0 to 1. So I think the
object is correctly instanciated and the connection works.

But now, I'm doing a var_dump on my object and I get this :
object(COM)(1) {
[0]=resource(127) of type (COM)
}

Arg. I don't understand this and the PHP manual doesnt help either. I would
have expected to get a list of methods/properties. At least the two I use to
authenticate.

var_dump ($obj[0]) returns null.
Could someone explain me more about this ?

Thanks,
This is correct; this is an external resource in PHP.

AFAIK, the only way you can get a list of properties and methods of a
COM object is if the COM object itself supports such a request.

And the resource object in PHP isn't an array, which is why you get null
when you try to dump $obj[0].

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 14 '07 #2
On Nov 14, 10:56 am, "Alex" <d_key...@hotma il.comwrote:
....
I'm trying to use a (remote) COM object from a PHP script (4.4, server has
apache2 win32).

The basics seem to work : I instantiate the COM object ($o = new COM"..."),
....
But now, I'm doing a var_dump on my object and I get this :
object(COM)(1) {
[0]=resource(127) of type (COM)
}

Arg. I don't understand this and the PHP manual doesnt help either. I would
have expected to get a list of methods/properties. At least the two I use to
authenticate.
Check out:
http://php.net/com_print_typeinfo

Csaba Gabor from Vienna

Nov 14 '07 #3
....
subsequent question : gettype returns "object". Shouldnt it return
"resource" ?

As a matter of fact get_resource_ty pe returns nothing at all, nor does
com_print_typei nfo .

What can I deduct ? simply that the object just doesnt support some requests
allowing to have this kind of info ?

--
Alex
[JDR] Visitez Extremia, un monde gratuit et en francais pour D&D et
autres jeux de role.
www.extremia.org
Nov 14 '07 #4
"Steve" <no****@example .comwrote in message
news:Ls******** *****@newsfe07. lga...
as in, you're a beginner to VB or, a beginner to php?
to COM :) and I havent touched VB since..... Win 3.11. :) I've been coding
in PHP for almost 10 years, but never had to use COM.
i'd create a component if you need to break this and other com objects
apart like this.

if you're using vb classic (the crusty old version), there are several
free and well written libraries that can expose any com object's
interfaces...in cluding types, params, etc.

if you're using vb.net, use it's reflection capabilities to do the same.
give your vb app the path to the dll, let it create it, and then go about
discovering its make-up.

either way, compile it to a com object to make it accessible to php. btw,
if using vb.net, you don't have to create in php the object being exposed.
your reflection-enabled com object can not only break-down the interfaces
for you, but you can also put 'invoke' methods on your object which defers
to the interface of the child object being exposed to php. make sense?
The object is already compiled. It's from a software vendor. I meant to say
that I have doc with the object, but all the examples of object usage are in
VB, which I have long forgotten. They use lists, for example all around the
place, and I don't remember how to translate this to PHP :)

--
Alex
[JDR] Visitez Extremia, un monde gratuit et en francais pour D&D et
autres jeux de role.
www.extremia.org
Nov 14 '07 #5

"Csaba Gabor" <da*****@gmail. comwrote in message
news:11******** **************@ 57g2000hsv.goog legroups.com...
Check out:
http://php.net/com_print_typeinfo
I know how to RTFM :)

Things are getting a bit "better" now : I replaced new COM() by com_load()
and voila, I have com_print_typei nfo working. Now I have to understand how
to access those lists they speak about in the doc.

That got rid of the errors "is not a COM object handler" I had in the PHP
log which I just had enabled.

--
Alex
[JDR] Visitez Extremia, un monde gratuit et en francais pour D&D et
autres jeux de role.
www.extremia.org
Nov 14 '07 #6

"Alex" <d_******@hotma il.comwrote in message
news:47******** *************** @news.free.fr.. .
"Steve" <no****@example .comwrote in message
news:Ls******** *****@newsfe07. lga...
>as in, you're a beginner to VB or, a beginner to php?

to COM :) and I havent touched VB since..... Win 3.11. :) I've been coding
in PHP for almost 10 years, but never had to use COM.
>i'd create a component if you need to break this and other com objects
apart like this.

if you're using vb classic (the crusty old version), there are several
free and well written libraries that can expose any com object's
interfaces...i ncluding types, params, etc.

if you're using vb.net, use it's reflection capabilities to do the same.
give your vb app the path to the dll, let it create it, and then go about
discovering its make-up.

either way, compile it to a com object to make it accessible to php. btw,
if using vb.net, you don't have to create in php the object being
exposed. your reflection-enabled com object can not only break-down the
interfaces for you, but you can also put 'invoke' methods on your object
which defers to the interface of the child object being exposed to php.
make sense?

The object is already compiled.
that wasn't the point i was making above...at all. however, no need to get
into that since that suggestion isn't your intended purpose.
It's from a software vendor. I meant to say that I have doc with the
object, but all the examples of object usage are in VB, which I have long
forgotten. They use lists, for example all around the place, and I don't
remember how to translate this to PHP :)
so, you know the object's interfaces...ju st not how to code it in php? same
way as any other object...

$o->interface;
$o->interface(para m);

etc.

am i missing something?
Nov 14 '07 #7
"Steve" <no****@example .comwrote in message
news:od******** *****@newsfe06. lga...
>It's from a software vendor. I meant to say that I have doc with the
object, but all the examples of object usage are in VB, which I have long
forgotten. They use lists, for example all around the place, and I don't
remember how to translate this to PHP :)

so, you know the object's interfaces...ju st not how to code it in php?
same way as any other object...

$o->interface;
$o->interface(para m);
etc.

am i missing something?
I'm pretty sure you're missing a lot less than I do :)

But it's getting better. I replaced "new COM()" by com_load() and now I can
use com_print_typei nfo which returns all the innards of the object. I don't
really know why com_load works better, but it is the case.

I also got to access one of the lists in the object. $....->item($i) . I'm
not sure whether it's a special syntax instead of item[$i] or those item()s
are really functions.

So things are getting better :)
However, my next blocking point is something called a factory. It is a
property of my COM object that is itself an ever-existing instance of a
class containing other objects. I think it is instanciated automatically by
the COM server when I create the object.

Everytime I put its name in my code ( $a =$obj->Factory; nothing more ),
Apache bombs with no explanation.

I have put the memory limit for PHP to 128M just to see but it doesnt change
anything.
--
Alex
[JDR] Visitez Extremia, un monde gratuit et en francais pour D&D et
autres jeux de role.
www.extremia.org
Nov 14 '07 #8

"Alex" <d_******@hotma il.comwrote in message
news:47******** *************** @news.free.fr.. .
"Steve" <no****@example .comwrote in message
news:od******** *****@newsfe06. lga...
>>It's from a software vendor. I meant to say that I have doc with the
object, but all the examples of object usage are in VB, which I have
long forgotten. They use lists, for example all around the place, and I
don't remember how to translate this to PHP :)

so, you know the object's interfaces...ju st not how to code it in php?
same way as any other object...

$o->interface;
$o->interface(para m);
>etc.

am i missing something?

I'm pretty sure you're missing a lot less than I do :)

But it's getting better. I replaced "new COM()" by com_load() and now I
can use com_print_typei nfo which returns all the innards of the object. I
don't really know why com_load works better, but it is the case.

I also got to access one of the lists in the object. $....->item($i) . I'm
not sure whether it's a special syntax instead of item[$i] or those
item()s are really functions.

So things are getting better :)
However, my next blocking point is something called a factory. It is a
property of my COM object that is itself an ever-existing instance of a
class containing other objects. I think it is instanciated automatically
by the COM server when I create the object.

Everytime I put its name in my code ( $a =$obj->Factory; nothing more ),
try:

$a = $obj->Factory();
Nov 14 '07 #9

"Alex" <d_******@hotma il.comwrote in message
news:47******** *************** @news.free.fr.. .
"Steve" <no****@example .comwrote in message
news:od******** *****@newsfe06. lga...
>>It's from a software vendor. I meant to say that I have doc with the
object, but all the examples of object usage are in VB, which I have
long forgotten. They use lists, for example all around the place, and I
don't remember how to translate this to PHP :)

so, you know the object's interfaces...ju st not how to code it in php?
same way as any other object...

$o->interface;
$o->interface(para m);
>etc.

am i missing something?

I'm pretty sure you're missing a lot less than I do :)

But it's getting better. I replaced "new COM()" by com_load() and now I
can use com_print_typei nfo which returns all the innards of the object. I
don't really know why com_load works better, but it is the case.

I also got to access one of the lists in the object. $....->item($i) . I'm
not sure whether it's a special syntax instead of item[$i] or those
item()s are really functions.

So things are getting better :)
However, my next blocking point is something called a factory. It is a
property of my COM object that is itself an ever-existing instance of a
class containing other objects. I think it is instanciated automatically
by the COM server when I create the object.

Everytime I put its name in my code ( $a =$obj->Factory; nothing more ),
Apache bombs with no explanation.

I have put the memory limit for PHP to 128M just to see but it doesnt
change anything.
Oh there's something I just realized.

This "factory" object is an instance of a class called Factory. But the doc
also makes mention of something called an interface (IFactory) who has the
same methods/Properties of the class. When I do a com_print_typei nfo on the
Factory, I get almost nothing :
class Factory { /* GUID={F4E856D4-FCD7-11D4-9D8A-0001029DEAF5} */
}When I do it on the interface, I get all my object's properties.

There HAS to be a difference :)

--
Alex
[JDR] Visitez Extremia, un monde gratuit et en francais pour D&D et
autres jeux de role.
www.extremia.org
Nov 14 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3212
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object.cs in rotor. What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't understand is:
28
20290
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()', this.pinginterval); - but is there no way to do this without using the literal ObjectName? If I write 'this.methodName()' I get "Line 1 Char 1: Object...
9
8567
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). On the aspx page I have the object tag as follows:
11
9223
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
44
2404
by: Steven T. Hatton | last post by:
This may seem like such a simple question, I should be embarrassed to ask it. The FAQ says an object is "A region of storage with associated semantics." OK, what exactly is meant by "associated semantics"? What, if any, associated semantics are shared by all objects? That part seems to go beyond the FAQ. Does anybody know of a resource...
16
25399
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have the properties: mode1, mode2, and mode3. This seems simple but I can't quite figure it out... Any ideas anyone?
0
4620
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object class (Object.cs in rotor). What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't understand is:
26
5649
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized several parts of the DOM, but this does not include the window object. Thank you
3
2759
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Defining_Functions doesn't actually give any insight.
2
2631
by: Ralph | last post by:
Hi I don't understand why it's not working: function schedule(imTop){ this.tdImagesTop = imTop; } schedule.prototype.selectEl = function() { alert(this.tdImagesTop);
0
7665
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7642
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.