以前在SP运营商工作了3年,现在不干,把我研究的CMPP3.0共享给大家.以便大家可以学习.
程序是用 VS.Net 2005 + MSSQL开发的.有什么不懂的地方大家可以给我留言.
点击下载:http://www.designcoding.com/Article.aspx?ID=28
程序是用 VS.Net 2005 + MSSQL开发的.有什么不懂的地方大家可以给我留言.
点击下载:http://www.designcoding.com/Article.aspx?ID=28
posted @ 2008-01-09 23:07 EndPoint 阅读(816) 评论(12) 编辑
首先要将这两个字段设置为"1"
tp_Pid = 1;
tp_Udhi = 1;短信内容编码要设置为:4也就是二进制MessageFmt=4;
然后对要发送的WapPush进行编码
static private byte[] WapPushUrl(string href)


{
href = href.ToLower().Replace("http://", "");
byte[] tmp = new byte[href.Length];
tmp = System.Text.Encoding.UTF8.GetBytes(href);
return tmp;
}
static private byte[] WapPushContent(string text)


{
byte[] tmp = new byte[text.Length];
tmp = System.Text.Encoding.UTF8.GetBytes(text);
return tmp;
}
//转换为16进制
private string bytesToHexStr(byte[] abyte0)


{
if(abyte0 == null)
return "";
System.Text.StringBuilder stringbuffer = new System.Text.StringBuilder(abyte0.Length * 3);
for(int i = 0; i < abyte0.Length; i++)


{
stringbuffer.Append(System.Convert.ToString(abyte0[i] & 0xff,16));
}
return stringbuffer.ToString();
}

public string GetWapString()


{
System.Text.StringBuilder tmp = new StringBuilder();
tmp.Append("0B05040B8423F0000303010129060603AE81EA8DCA02056A0045C6080C03");
tmp.Append(bytesToHexStr(WapPushUrl(Href)));
tmp.Append("000103");
tmp.Append(bytesToHexStr(WapPushContent(Text)));
tmp.Append("000101");

return tmp.ToString().ToUpper();
}
tp_Pid = 1;
tp_Udhi = 1;短信内容编码要设置为:4也就是二进制MessageFmt=4;
然后对要发送的WapPush进行编码
static private byte[] WapPushUrl(string href)

{
href = href.ToLower().Replace("http://", "");
byte[] tmp = new byte[href.Length];
tmp = System.Text.Encoding.UTF8.GetBytes(href);
return tmp;
}
static private byte[] WapPushContent(string text)

{
byte[] tmp = new byte[text.Length];
tmp = System.Text.Encoding.UTF8.GetBytes(text);
return tmp;
}
//转换为16进制
private string bytesToHexStr(byte[] abyte0)

{
if(abyte0 == null)
return "";
System.Text.StringBuilder stringbuffer = new System.Text.StringBuilder(abyte0.Length * 3);
for(int i = 0; i < abyte0.Length; i++)

{
stringbuffer.Append(System.Convert.ToString(abyte0[i] & 0xff,16));
}
return stringbuffer.ToString();
}
public string GetWapString()

{
System.Text.StringBuilder tmp = new StringBuilder();
tmp.Append("0B05040B8423F0000303010129060603AE81EA8DCA02056A0045C6080C03");
tmp.Append(bytesToHexStr(WapPushUrl(Href)));
tmp.Append("000103");
tmp.Append(bytesToHexStr(WapPushContent(Text)));
tmp.Append("000101");
return tmp.ToString().ToUpper();
}posted @ 2007-04-15 20:54 EndPoint 阅读(576) 评论(0) 编辑


