Jump to content


Photo

Binary conversion to xml


  • Please log in to reply
2 replies to this topic

#1 spelltwister

spelltwister
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 20 August 2006 - 03:49 PM

Hey all,

I have a vb.net application that posts some data to a php page as binary.  However, I do not know how to convert it back to usable xml.  Is there a way, and if so, how ;-D.

Thanks,

Mike

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 20 August 2006 - 03:52 PM

Check out bin2hex (http://www.php.net/bin2hex), pack (http://www.php.net/pack), and unpack (http://www.php.net/unpack).

Unpack will probably help the most, depending on how the actual encoding is done.

#3 spelltwister

spelltwister
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 20 August 2006 - 04:11 PM

I'm not sure if this is correct to say, but the program has:  encoding.ascii.getbytes(string) as the encoding type so it's a char array to binary array.

I'm having a little difficulty with that unpack thing, I googled it for examples, but I realy don't understand.

If I have a string: "hello" encoded as above, how would I get it back?
I have seen an example saying:

$unpacked = unpack("s*0", $packed);
and that will be a string of the desired data.  Is this correct? and will that mean that I will be able to use it as the complete xml file?

If not and i have to use the returned array with unpack("c",$packed)<== not sure if that's even correct, how can I create the xml file out of that?

Lastly, how do I even reference it?  What sort of get or post command will retreive that?

Thanks,

Mike




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users