Hex problem

hye guys, i have a .txt file which contain hex value such as F5/01/00/01/00/03/00/F5 (03 nad 01 appear as boxes in text file), and i wanted to take this value into php and convert it into binary. is it possible?

Is the string actually the hex string?
e.g.
“F5010001000300F5” ?

My first question, is why store it in this format? Store the binary and safe a lot of work/effort?

it actually an output from a device,i just transfer it to a file.

Have you tried:


$binary = hex2bin(file_get_contents('file.txt));

or:


$binary = pack('H*' , file_get_contents('file.txt));

tried already…but still can’t…i use this code below


$contents = file_get_contents('output.txt'); 
echo $contents;

and the output is õõõõõõõõõõõõ. thats F5F5F5F5F5F5F5 in ISO-8859-1 format…why is that?

Can you paste the exact contents of output.txt or at least the first few hundred bytes.

u can go to this link and see the picture. http://ubuntuforums.org/showthread.php?t=2133190 its inside the thread.