The Code is as follows:
Type wappushpdustruct
Smsclen as string
Smsctype as string
SMSC as string
Protocol as string
Tpmrbase as string
Rephonenumlen as string
Rephonenumtype as string
Rephonenum as string
Tppid as string
Tpdsc as string
Tpvp as string
Msglen as string
Wappushheadlen as string
Wappushflag as string
Datalen as string
Wappushcombflag as string
Total as string
Msgid as string
Wappushudh as string
Wappushpud as string
'Wappushbegin as string
'Wsp as string
'Flag as string
'Dtdsiflag as string
'Utf as string
'Flagbegin as string
'Sibegin as string
'
'Indicationbegin as string
'
'Action as string
'Href as string
'Hrefbegin as string
Wappushindicator as string
URL as string
'Hrefend as string
'Split as string
'Titlebegin as string
Wappushdisplaytextheader as string
Title as string
'Titleend as string
'Siend as string
'Indicationend as string
Endofwappush as string
Pdulen as integer
PDU as string
End type
Public Function genwappushpdu (byval URL as string, byval title as string, byval SMSC as string, byval phonenum as string) as wappushpdustruct
Dim wappush as wappushpdustruct
With wappush
'. Smsclen
'. Smsctype
. SMSC = SMSC
. Protocol = "51"
. Tpmrbase = "00"
'. Rephonenumlen
'. Rephonenumtype
. Rephonenum = phonenum
Formatphonenum. SMSC,. smsctype
. Smsclen = int2hexstr (LEN (. SMSC &. smsctype)/2) 'short message center address length. (Text message center number type + text message center number length/2 hexadecimal representation)
'Msg. destphonenumtype: called number type. If there are more than 86, the value is "91"; otherwise, the value is "81"
. Rephonenumlen = int2hexstr (formatphonenum (. rephonenum,. rephonenumtype) ''the length of the called number. The hexadecimal representation of the called number length.
. Tppid = "00"
'. Tpdsc = "A6"
. Tpdsc = "04" 'user Information encoding method F5
. Tpvp = "A7"
'. Tpvp = "FF"
'. Msglen
'
'Dim push_head1, push_head2 as string
'
'Push_head1 = "0b05040b8423f4243030101"
'Push_head2 = "29060603ae81ea8dca" '// 81ea8d98 02 06 6a 00 85 09 03
. Wappushheadlen = "0b"
'The following content is after UDH
. Wappushflag = "00"
. Datalen = "03"
. Wappushcombflag = "03"
. Total = "01"
. Msgid = "01"
'Format 1
'. Wappushudh = "0605040b8423f0"
'. Wappushpud = "81060603ae81ea8d00"' // The last bit is the wbxml length;
'. Wappushindicator = "02056a0045c6080c03"
'Format 2
'. Wappushudh = "0605040b8423f0"
'. Wappushpud = "010603ae8dc4"
'. Wappushindicator = "02056a0045c6080c03"
'
'Format 3
'
'. Wappushudh = "0b05040b8423fda-3030101"
'. Wappushpud = "29060603ae81ea8dca"
'. Wappushindicator = "02056a0045c6080c03"
'
''Format 4
''// There is one more than Zhao bangben, and it is not successful here;
'. Wappushudh = "0605040b8423f0"
'. Wappushpud = "250601ae"
'. Wappushindicator = "02056a0045c6080c03"
'
''Format 5
'. Wappushudh = "0605040b8423f0"
'. Wappushpud = "250601ae"
'. Wappushindicator = "01056a0045c60c03"' // Old Zhao version; unsuccessful
'
'Format 6
. Wappushudh = "0605040b8423f0"
. Wappushpud = "250601ae"
. Wappushindicator = "02056a0045c60c0"
'
''Format 7
'. Wappushudh = "0605040b8423f0"
'. Wappushpud = "72060a03ae81eaaf828d"' // The last bit is the wbxml length;
'. Wappushindicator = "80b48402056a0045c60c03"
'. Wappushdisplaytextheader = "00080103"
'
''Format 8
'. Wappushudh = "0b05040b8423fda-3030101"
'. Wappushpud = "29060603ae81ea8dca"' // The last bit is the wbxml length;
'. Wappushindicator = "02056a0045c60c03"
'. Wappushdisplaytextheader = "00080103"
'
''Format 9
'. Wappushudh = "0605040b8423f0"
'. Wappushpud = "81060803ae81eab4848d"' // The last bit is the wbxml length;
'. Wappushindicator = "02056a0045c6080c03"
. Wappushdisplaytextheader = "000103"
. Endofwappush = "000101"
'. Url = gb2unicode (URL)
. Url = str2hexstr (URL)
'. Title = gb2unicode (title)
. Title = str_utf_8 (title, "hex ")
Dim str1, str2 as string
'================================================ ========================================================== ========================================================== ======================
Str1 =. smsclen &. smsctype &. SMSC &. Protocol &. tpmrbase &. rephonenumlen &. rephonenumtype &. rephonenum &. tppid &. tpdsc &. tpvp
'Str1 =. smsclen &. smsctype &. SMSC & "11 "&. rephonenumlen &. rephonenumtype &. rephonenum &. tppid &. tpdsc &. tpvp 'text message header, according to the normal text message
'
Str2 =. wappushudh &. wappushpud &. wappushindicator &. url &. wappushdisplaytextheader &. Title &. endofwappush
. Msglen = int2hexstr (LEN (str2)/2)
'. Msglen = int2hexstr (LEN (. url) + Len (. Title) + 1)
. PDU = str1 &. msglen & str2
'. Pdulen = Len (. PDU)/2
. Pdulen = Len (. PDU)/2-9
'. Pdulen = Len (. PDU)/2-1
End
Genwappushpdu = wappush
End Function