Accessing a property of a COM object

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
strafingmoose
Forum Newbie
Posts: 15
Joined: Mon Apr 18, 2011 2:56 pm

Accessing a property of a COM object

Post by strafingmoose »

Hello everyone!

I am creating a COM object like this:

Code: Select all

$_GLOBALS["C2"] = new COM("C2WebC4_1_017.WebClient") or die("Could not initiate COM object");
If I do:

Code: Select all

com_print_typeinfo($_GLOBALS["C2"]);
I get, amongst other things:

Code: Select all

/* DISPID=1745027094 */ 
 /* VT_VARIANT [12] */ 
 var $value; 
How do I access the data in $value ?

Doing:

Code: Select all

var_dump ($_GLOBALS["C2"]->value);
returns:

Code: Select all

Fatal error: Uncaught exception 'com_exception' with message 'Error [0x8002000f] Parameter not optional. ' in C:\Inetpub\wwwroot\WebClient\WebClientV2Dev\test.php:14 Stack trace: #0 C:\Inetpub\wwwroot\WebClient\WebClientV2Dev\test.php(14): unknown() #1 {main} thrown in C:\Inetpub\wwwroot\WebClient\WebClientV2Dev\test.php on line 14
Any ideas ? I am suprised it is requesting a parameter since I'm trying to access a property, not a method :dubious:

Thanks!
strafingmoose
Forum Newbie
Posts: 15
Joined: Mon Apr 18, 2011 2:56 pm

Re: Accessing a property of a COM object

Post by strafingmoose »

Anyone ? :oops:
Post Reply