打印字节字符串,以便java应用程序可以看到它或接收字节信息并正确解析它

I have to print the content of an image in bytes. I send a response in the MIME Multipart/Related Content-type. So the body of my response is like this:

$eol="
";
echo "Content-Type: image/jpeg".$eol;
echo "Content-Length: ".strlen($image).$eol;
echo "Content-Transfer-Encoding: binary".$eol;
---Content of image in bytes----

So this is how I tried to print the bytes.

//I receive an array of bytes from image
$imageContent=file_get_contents('./1.jpg');
$byte_array = unpack('C*', $imageContent);

foreach ($byte_array as $byte) 
{
    echo $byte;
}

or

$image="";
foreach ($byte_array as $byte) 
{
    $image.=$byte;
}
echo $image;

Both shows me an empty result after trying to print the bytes. So how can I do it?
UPDATE: var_dump of $byte_array is like:

    array(129743) {
      [1]=>
      int(255)
      [2]=>
      int(216)
      [3]=>
      int(255)
      [4]=>
      int(224)
      [5]=>
      int(0)
      [6]=>
      int(16)
      [7]=>
      int(74)
      [8]=>
      int(70)
      [9]=>
      int(73)
      [10]=>
      int(70)
      [11]=>
      int(0)
      [12]=>
      int(1)
      [13]=>
      int(1)
      [14]=>
      int(0)
      [15]=>
      int(0)
      [16]=>
      int(1)
      [17]=>
      int(0)
      [18]=>
      int(1)
      [19]=>
      int(0)
      [20]=>
      int(0)
      [21]=>
      int(255)
      [22]=>
      int(219)
      [23]=>
      int(0)
      [24]=>
      int(67)
      [25]=>
      int(0)
      [26]=>
      int(2)
      [27]=>
      int(1)
      [28]=>
      int(1)
      [29]=>
      int(1)
      [30]=>
      int(1)
      [31]=>
      int(1)
      [32]=>
      int(2)
      [33]=>
      int(1)
      [34]=>
      int(1)
      [35]=>
      int(1)
      [36]=>
      int(2)
      [37]=>
      int(2)
      [38]=>
      int(2)
      [39]=>
      int(2)
...}

UPDATE changed unpack('C*', $imageContent); to pack('a*', $vectorContent); and pass this data. Java coder says that it's binary data. I'm waiting whet he test that the image is right. I receive data from him in format like:

436f 6e74 656e 742d 4c65 6e67 7468 3a20
3138 3830 0d0a 0d0a ffd8 ffe0 0010 4a46
4946 0001 0101 0060 0060 0000 ffdb 0043
0010 0b0c 0e0c 0a10 0e0d 0e12 1110 1318
281a 1816 1618 3123 251d 283a 333d 3c39
3338 3740 485c 4e40 4457 4537 3850 6d51

When I try this:

$query = file_get_contents("php://input");
$queryHex=unpack("H*", $query);

vardump of $queryHex gives me:

array(1) {
  [1]=>
  string(2558) "3433366620366537342036353665203734326420346336352036653637203734363820336132300a3331333820333833..."

How to receive proper data?