Returning binary data - HOW?

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

 



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!

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

  Powered by Linux