wappush
来源:互联网 发布:js正则判断数字和字母 编辑:程序博客网 时间:2024/05/16 13:56
function TForm1.WapPushMsg(sTitle, sUrl: string; dStart, dOver: TDateTime): string;const sBody: string = '02056A0045C6080C03%s000AC307%s10C307%s0103%s000101'; sPush: string = '0605040B8423F081060603AE81EA8D%.*x%s'; function StrOrdHex(S: string): string; begin SetLength(Result, Length(S)*2); BinToHex(PChar(S), PChar(Result), Length(S)); end; var asUrl: string; iii:integer;begin Result := Format(sBody, [StrOrdHex(sUrl), FormatDateTime('yyyymmddhhnnss', dStart), FormatDateTime('yyyymmddhhnnss', dOver), StrOrdHex(AnsiToUtf8(sTitle))]); if Length(Result) >= 256 then raise Exception.Create('消息太长,请缩短标题或地址长度'); iii:=Length(Result) ; asUrl:=inttostr(iii); iii:=Length(Result) div 2 ; asUrl:=inttostr(iii); Result := Format(sPush, [2, Length(Result) div 2 + 128, Result]); Result := Format('FFFF%s', [Result]);end; --------------------------------- using System;using System.Collections.Generic;using System.Text; namespace common{ public class WapPush { private string StrToHex(string str) { string strTemp = ""; if (str == "") return ""; byte[] bTemp = System.Text.Encoding.Default.GetBytes(str); for (int i = 0; i < bTemp.Length; i++) { strTemp += bTemp[i].ToString("X"); } return strTemp; } public byte[] WapPushUrl(string href) { byte[] tmp = new byte[href.Length]; tmp = System.Text.Encoding.UTF8.GetBytes(href); return tmp; } public byte[] WapPushContent(string text) { byte[] tmp = new byte[text.Length]; tmp = System.Text.Encoding.UTF8.GetBytes(text); return tmp; } //转换为16进制 public 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()).ToUpper(); } public string GetWapString(string Url, string Content, DateTime BeginDatetime, DateTime EndDatetime) { System.Text.StringBuilder tmp = new StringBuilder(); tmp.Append("02056A0045C6080C03"); tmp.Append(bytesToHexStr(WapPushUrl(Url))); tmp.Append("000AC307"); tmp.Append(BeginDatetime.ToString("yyyyMMddHHmmss")); tmp.Append("10C307"); tmp.Append(EndDatetime.ToString("yyyyMMddHHmmss")); tmp.Append("0103"); tmp.Append(bytesToHexStr(WapPushContent(Content))); tmp.Append("000101"); System.Text.StringBuilder sPush = new StringBuilder(); sPush.Append("FFFF0605040B8423F081060603AE81EA8D"); int iLength = tmp.ToString().Length / 2 + 128; sPush.Append(Convert.ToString(iLength, 16)); sPush.Append(tmp.ToString()); return sPush.ToString().ToUpper(); } //public string GetWapString(string Url, string Content) //{ // System.Text.StringBuilder tmp = new StringBuilder(); // tmp.Append("0B05040B8423F0000303010129060603AE81EA8DCA02056A0045C6080C03"); // tmp.Append(bytesToHexStr(WapPushUrl(Url))); // tmp.Append("000103"); // tmp.Append(bytesToHexStr(WapPushContent(Content))); // tmp.Append("000101"); // return tmp.ToString().ToUpper(); //} private string StrToHex1(string str) { string strTemp = ""; if (str == "") return ""; byte[] bTemp = System.Text.Encoding.Default.GetBytes(str); for (int i = 0; i < bTemp.Length; i++) { strTemp += bTemp[i].ToString("X"); } return strTemp; } }}
- wappush
- WAPPUSH代码
- 发送WapPush(C#)
- Cmpp发送wappush
- SMS发送WapPush
- wappush,pdu Modem信息
- wappush系统框架
- 通过短信网关发送Wappush(包括超长Wappush)C#代码
- 通过短信网关发送Wappush(包括超长Wappush)
- 用php生成wappush文件
- 用php生成wappush文件
- 系列WAPPUSH代码-更新版本
- CMPP下发WAPPUSH编码转换
- 通过短信网关发送Wappush消息
- 通过短信网关发送Wappush消息
- 通过短信网关发送Wappush消息
- 点到点短信WAPPUSH研究总结
- 点到点短信WAPPUSH研究总结
- Cuyahoga内容管理精髓
- 疯狂的程序员63
- Pear 的Excel类写数据需要注意的地方
- ASP.NET中应用Excel:(6)在服务器端生成HTML表格
- 完美解决dataset导出excel问题
- wappush
- Linux几个简单使用的命令
- DIV 和 TABLE 应该如何配合使用
- DIV 和 TABLE 应该如何配合使用
- 做了个梦
- 数据库转换工具之ESF Database Convert
- RHEL4上安装使用tripwire
- 让HGE支持中文(4) - 编辑框的实现
- SetWindowPos