Page 1 of 1

how to get a 'Byte Array' type varable in php4

Posted: Thu Jul 15, 2004 11:56 pm
by xuleit
--------------------------------------------------------------------------------

I am writing a PHP interface with an API that requires a "Byte Array" as a data type. I know Perl has a "USE BYTES" option that will allow the data to be recognized as bytes. Does anyone know if PHP has similar support for the issue            posted by thna_brianb
now i meet the same problem,can anyone help me?
thanks in adv.

Posted: Fri Jul 16, 2004 12:01 am
by feyd

Code: Select all

for($x = 0, $y = strlen($stream); $x < $y; $x++)
{
  $byte = $stream{$x};            // <-- each byte is found in the result..
}

thanks,but i really need some thing like this ...

Posted: Fri Jul 16, 2004 12:10 am
by xuleit
feyd,thank u very much.

but i really need a result like the code write in asp byte[] $byteIV .

Posted: Fri Jul 16, 2004 12:12 am
by feyd
ok..

Code: Select all

<?php

$bytes = array();

for($x = 0, $y = strlen($stream); $x < $y; $x++) 
{ 
  $bytes[] = $stream{$x};
}

?>

sorry,i did not express my meaning clearly

Posted: Fri Jul 16, 2004 1:17 am
by xuleit
this code writen in jsp works
<%@ import="Microsoft.DVAP.PSO.* " %>
<%
byte[] iv = PSOCryptography.IVGenerator(strIV);
String SPItemRequest=PSOCryptography.GenerateSPItemRequest(ReturnURL,iv);
%>

i'll write some code in php like the code above
$vnet=new java("Microsoft.DVAP.PSO.PSOCryptography");
$byteIV=$vnet->IVGenerator($strIV);
$SPItemRequest=$vnet->GenerateSPItemRequest($ReturnURL,$byteIV);
it doesn't work. :(

now it works!!

Posted: Mon Jul 19, 2004 1:05 am
by xuleit
i installed a wrong version's jsdk,replace j2sdk with jsdk then works well