import http.client
import codecs
hex_str = “8C8098323638303833008D90891A802B313938363236383038303030302F545950453D504C4D4E009731363731373934393834382F545950453D504C4D4E009605EA313131008681841EB38A323638302E736D696C00896170706C69636174696F6E2F736D696C00022C822C6170706C69636174696F6E2F736D696C008183C0223C323638302E736D696C3E008E323638302E736D696C003C736D696C3E0D0A3C686561643E0D0A3C6C61796F75743E0D0A3C726F6F742D6C61796F75742077696474683D2231363022206865696768743D22333230222F3E0D0A3C726567696F6E2069643D22496D616765222077696474683D2231363022206865696768743D2233323022206C6566743D22302220746F703D2230222F3E0D0A3C726567696F6E2069643D2254657874222077696474683D223130302522206865696768743D223130302522206C6566743D2230252220746F703D223025222F3E0D0A3C2F6C61796F75743E0D0A3C2F686561643E0D0A3C626F64793E0D0A3C7061723E0D0A3C74657874207372633D22323638302E7478742220726567696F6E3D225465787422202F3E0D0A0D0A3C2F7061723E0D0A3C2F626F64793E0D0A3C2F736D696C3E0D0A0E03038381838E323638302E74787400323232”
hex_str = hex_str.replace(" ", “”) # 删除空格
dadas = codecs.decode(hex_str, “hex”).decode(“utf-8”,errors=‘ignore’)
header = {
‘Content-Type’: ‘application/vnd.wap.mms-message’,
‘Accept’:‘application/vnd.wap.mms-message,text/plain,/’,
‘Method’:“POST”,
‘KeepAlive’:“false”,
‘UserAgent’:‘Nokia6681/2.0 (4.00.15) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1’,
'Host':'mmsc.myuni.com.cn',
'Accept':'*/*,application/vnd.wap.mms-message,application/vnd.wap.sic',
'Accept-Charset': 'utf-8',
'Accept-Language': 'en-GB',
'Content-Type': 'application/vnd.wap.mms-message',
'Content-Length':'"'+str(len(dadas))+'"',
'Connection':'Keep-Alive',
'User-Agent': 'SAMSUNG-SGH-E908/NetFront3.2/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1',
}
设置目标服务器和端口号
host = ‘10.0.0.172’
port = 80
创建连接
conn = http.client.HTTPConnection(host, port)
aa=conn.request(‘POST’, ‘http://mmsc.myuni.com.cn’,dadas.encode(“UTF-8”), headers=header)
print(aa)
拨号发出去后,返回400错误 有没有已经构建好的包?求大佬指点一下