Encoding lengths (with PHP)

Encoding lengths (with PHP) SearchSearch
Author Message
hamid el abassi
New member
Username: Frostyrebel

Post Number: 1
Registered: 05-2004
Posted on Thursday, May 13, 2004 - 02:23 pm:   

Hello

I am trying to encode a mms from a php file, but there are some hex codes (like 83) i don't understand.
Can anybody also check if i understood the other correctly

How can i calculate the header-length within PHP
How can i reproduce a content-length of 233 (=e9) to be 81 69

Here is a sample which i decoded from a mms i created. It contains just 1 text file. Basically to understand the basics before i continue.

8C 84 // message-type
98 30 30 31 00 // transaction-id: 001
8D 90 // version: 1.0
85 04 44 39 1F 54 // date
89 05 80 6D 6D 73 00 // from: mms
97 68 61 6D 69 64 00 // to: hamid
96 74 65 73 74 00 // subject: test
84 // Content-type
83 // ??
01 // number of entries
1A // text/plain
0B // content-length (11 bytes)
83 // ??
C0 // Content-id
22 // "
3C 68 61 6D 69 64 2E 74 78 74 3E 00 <hamid.txt>
8E // Content-location
68 61 6D 69 64 2E 74 78 74 00 // hamid.txt
74 65 73 74 20 69 74 20 6F 75 74 // test it out

hamid el abassi
New member
Username: Frostyrebel

Post Number: 2
Registered: 05-2004
Posted on Thursday, May 13, 2004 - 11:14 pm:   

i found out that 83 is the content-type text/plain, but now i wonder what 1A is.
I guess it is the header-len.

How do i calculate the header-len (preferably with PHP) and what is it based on?

Does anyone have any suggestions?