COM Help (hopefully)

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

 



We have a US postal database called ZP4 that we that we use to scrub
client addresses into something useful. For future projects we need to
expand on this scrubbing so that we can view counties and such. The
scrubbing is currently being performed by a custom application a
former employee wrote for us while he still worked here.
Unfortunately, he didn't commit the source of that application into
our SVN repository (bad). Sadly, I don't have C/C++ creation skills
worth relying upon.

What I found in ZP4 is a COM wrapper for the ZP4 DLL. From the
examples it should be simple to implement what I want, and this VB
code does work fine:

--- begin ---
Set ZP4 = CreateObject("zp4ipcom.zp4com")
ZP4.reset
ZP4.input "Address", "2401 Utah avenue south"
ZP4.input "City", "seattle"
ZP4.input "State", "wa"
ZP4.input "ZIP", "98134"
ZP4.correct

WScript.Echo ZP4.output("Error code")
WScript.Echo ZP4.output("Address (final)")
WScript.Echo ZP4.output("City (final)")
WScript.Echo ZP4.output("State (final)")
WScript.Echo ZP4.output("ZIP (five-digit)")
WScript.Echo ZP4.output("County name")
--- end ---

However, when I implement this code in PHP using COM all I get are errors:

<?php
	try
	{
		$zp4 = new com( 'zp4ipcom.zp4com' );

		$zp4->reset();
		$zp4->input( 'Address', '2401 Utah avenue south' );
 		$zp4->input( 'City', 'seattle' );
 		$zp4->input( 'State', 'wa' );
 		$zp4->input( 'ZIP', '98134' );
		$zp4->correct();

		echo( $zp4->output( 'Error code' ) . "\n" );
		echo( $zp4->output( 'Address (final)' ) . "\n" );
		echo( $zp4->output( 'City (final)' ) . "\n" );
		echo( $zp4->output( 'State (final)' ) . "\n" );
		echo( $zp4->output( 'ZIP (five-digit)' ) . "\n" );
		echo( $zp4->output( 'County name' ) . "\n" );
	}
	catch( exception $e )
	{
		echo( $e . "\n" );
	}
?>

Results:

exception 'com_exception' with message 'Error [0x80020003] Member not found.
' in C:\Documents and Settings\adamr\Desktop\zp4.com.php:7
Stack trace:
#0 C:\Documents and Settings\adamr\Desktop\zp4.com.php(7): com->reset()
#1 {main}

I've tried everything I could think to get the above to work. If I
specify a member that I know is not in the ZP4 DLL I get a different
error. The "Member not found" error always seems to line up with the
procedures/functions defined in the ZP4IPCOM source.

ZP4 is a Windows only application. My development machine is running
PHP 5.2.6. I've done other COM related code with Word without any
troubles. I'm guessing that maybe the ZP4IPCOM interface itself is not
complete enough for PHP, or there is some bug that I'm missing. The
source for the ZP4IPCOM is provided with the ZP4 disk, but it's all in
Pascal and I'm not sure hot to either tweak or rebuild that (my VS
2005 doesn't seem to think much of it :)

While I could go with a VB solution for doing the address scrubbing, I
had wanted to set it up in PHP so that I could open one COM connection
to the DLL, and then via database burn through a large number of
addresses. If I had the skills I'd also rather just create an
extension for PHP itself that is a wrapper for the ZP4 DLL. If someone
is interested in building that for my company on commission I'd love
to discuss that with you.

If anyone wants to help me with this I'd greatly appreciate it.

Regards,

Adam.

-- 
Adam Randall
http://www.xaren.net
AIM: blitz574

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux