[SOLVED] how to get a 'Byte Array' type varable in php4

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
xuleit
Forum Newbie
Posts: 14
Joined: Sun Feb 15, 2004 6:41 pm

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

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

for($x = 0, $y = strlen($stream); $x < $y; $x++)
{
  $byte = $stream{$x};            // <-- each byte is found in the result..
}
xuleit
Forum Newbie
Posts: 14
Joined: Sun Feb 15, 2004 6:41 pm

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

Post by xuleit »

feyd,thank u very much.

but i really need a result like the code write in asp byte[] $byteIV .
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

ok..

Code: Select all

<?php

$bytes = array();

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

?>
xuleit
Forum Newbie
Posts: 14
Joined: Sun Feb 15, 2004 6:41 pm

sorry,i did not express my meaning clearly

Post 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. :(
xuleit
Forum Newbie
Posts: 14
Joined: Sun Feb 15, 2004 6:41 pm

now it works!!

Post by xuleit »

i installed a wrong version's jsdk,replace j2sdk with jsdk then works well
Post Reply