Returning binary data - HOW?

From: Date: Mon, 06 Feb 2006 12:22:30 +0000
Subject: Returning binary data - HOW?
Groups: php.windows 
Request: Send a blank email to php-windows+get-26681@lists.php.net to get a copy of this message
Hi - I've been stuck on this for 12 hours now and run out of ideas. Wondering if someone can help me? My PHP page calls a COM object which is supposed to return some binary data which is then sent back to the user. The problem I have is that once the call to my COM object is done, PHP thinks the returned binary string is actually 1/2 the size because it's interpreting it as wide characters. I've tried returning both a BSTR and a VARIANT (Safearray of VT_UI1), and both end up 1/2 size. Does anyone know if it's possible to have a com object allocate say 128 bytes of data, and return it to PHP in a way that 128 bytes of data are written out to the requesting browser? My php looks like this: $inputBuf = "some data"; $myObject = new COM("BinarySource.BinarySourceObj"); $outputBuf = myObject->createBinaryData( $inputBuf ); // this object returns 128 *bytes* of data print( $outputBuf ); // This sends out only 64 bytes!! I've tried both of these for my COM object, and both result in 1/2 the # of bytes sent: HRESULT createBinaryData([in] BSTR source, [out, retval] BSTR* outputBuffer); HRESULT createBinaryData([in] BSTR source, [out, retval] VARIANT* outputBuffer); **NOTE: This COM object works if I use an ASP page and call ASP's Response.BinaryWrite() function with the version that returns a VARIANT. Any ideas?? Thank you!

« previous php.windows (#26681) next »