RE: The COM problem when converting from ASP to PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yeah, this is some of the fun of dealing with COM and PHP.  Microsoft
puts all kinds of little shortcuts into their system that are difficult
to access via PHP.  I'm sure there's a smarter programmer out there than
I am who knows how to make this work properly, but here's my 2 cents:

1. When you call some methods to a COM object, they may only return a
SUCCESS or FAIL type message, not an actual value.  That's the case in
this instance.  It's almost like you're passing a reference to the
variables in ASP, not the value of the variable.  You might try doing
something like    $com->GenerateSigningKeys(&$privkey,&$pubkey);      or
something..  I don't know, I don't have a lot of practice with passing
references, I usually do something and keep playing with it until it
works.  But adding the &'s might do something.

2. When you call a method, the parameters that you call it with (in this
case, $privkey and $pubkey) are NOT changed by the method of the COM
object.  If you did $methodresults =
$com->GenerateSigningKeys($privkey,$pubkey);  you'd at least get a
failure code if it failed to generate the keys.

Read through the data model for this COM object at:
http://msdn.microsoft.com/library/en-us/wmrm/htm/keysgeneratesigningkeys
.asp


I'm kind of at a loss here but thought I'd at least give you this much,
maybe it'll help.

-TG


> -----Original Message-----
> From: Steven Kidd [mailto:helixserver@xxxxxxxxxxx] 
> Sent: Friday, April 23, 2004 9:16 PM
> To: php-windows@xxxxxxxxxxxxx
> Subject:  The COM problem when converting from ASP to PHP
> 
> Hi,
> 
> <<I think it's more suitable for the php-windows list so I post here 
> again,sorry. -- stev>>
> 
> When I converting lines of ASP code:
> 
> <%
> dim keysobjs
> dim privkey
> dim pubkey
> dim seed
> Set keysobj= CreateObject("wmrmobjs.WMRMKeys")
> keysobj.GenerateSigningKeys privkey, pubkey
> seed = keysobj.GenerateSeed()
> Response.Write privkey
> Response.Write "<br>"
> Response.Write pubkey
> Response.Write "<br>"
> Response.Write seed
> %>
> 
> To the PHP one:
> 
> <?
> $com = new COM("wmrmobjs.WMRMKeys");
> $com->GenerateSigningKeys($privkey,$pubkey);
> $seed = $com->GenerateSeed();
> 
> echo "Private key=".$privkey;
> echo "<br>";
> echo "Public key=".$pubkey;
> echo "<br>";
> echo "Seed=".$seed;
> ?>
> 
> In the ASP code everything works pretty well,
> In the PHP code, although I can obtain the value of $seed,
> the $privkey and $pubkey are null,
> kindly check the code for me, thx...

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux