marvin_g — 2013-04-08T02:59:21-04:00 — #1
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?
tomb — 2013-04-08T05:57:42-04:00 — #2
Is the string actually the hex string?
My first question, is why store it in this format? Store the binary and safe a lot of work/effort?
marvin_g — 2013-04-08T06:07:15-04:00 — #3
it actually an output from a device,i just transfer it to a file.
tomb — 2013-04-08T06:21:58-04:00 — #4
Have you tried:
$binary = hex2bin(file_get_contents('file.txt));
$binary = pack('H*' , file_get_contents('file.txt));
marvin_g — 2013-04-08T10:15:04-04:00 — #5
tried already..but still can't..i use this code below
$contents = file_get_contents('output.txt');
and the output is õõõõõõõõõõõõ. thats F5F5F5F5F5F5F5 in ISO-8859-1 format..why is that?
tomb — 2013-04-08T10:50:05-04:00 — #6
Can you paste the exact contents of output.txt or at least the first few hundred bytes.
marvin_g — 2013-04-08T11:10:22-04:00 — #7
u can go to this link and see the picture. http://ubuntuforums.org/showthread.php?t=2133190 its inside the thread.
system — 2014-10-08T00:02:02-04:00 — #8
This topic is now closed. New replies are no longer allowed.