⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 怎样做一个给手机发送短信的程序?.htm

📁 大家可以看看
💻 HTM
📖 第 1 页 / 共 2 页
字号:
      if TpDcs='08' then
        TPUserDataLength:=format('%2.2X',[length(TpUserData) div 2])
      else
        TPUserDataLength:=format('%2.2X',[((length(TpUserData) div 2)*8) div 7]);
      Rlt_str:=lenSmsInfo
              +firstOctet
              +TPMessageReference
              +AddressLength
              +TypeOfAddress
              +DestPhoneNum
              +TpId
              +TpDcs
              +TPValidityPeriod
              +TPUserDataLength
              +TpUserData;//TpUserData have to Encoded;
      StrCopy(Result_String,pchar(Rlt_str));
      Result:=true;
     end;
end;

function ConvertPhoneNum(strNum:string):string;
var
i:integer;
str:string;
A_Pchar:pchar;
begin
  str:=strNum;
  i:=length(str);
  if odd(i) then
    begin
      str:=str+'F';
      A_Pchar:=StrAlloc(40);
      if Transposition(pchar(str),A_pchar) then
        result:=string(A_Pchar)
      else
        result:='Null';
    end
  else
    begin
      A_Pchar:=StrAlloc(40);
      if Transposition(pchar(str),A_pchar) then
        result:=string(A_Pchar)
      else
        result:='Null';
    end;
end;

function Transposition(instr:pchar;Result_str:pchar):Bool;
var
  i:integer;
  temp:string;
  destStr:string;
  In_String:string;
begin
if length(instr)>0 then
  begin
    destStr:='';
    In_String:=string(instr);
    setlength(In_String,length(In_String));
    i:=1;
    while i<length(In_String) do
      begin
        temp:=In_String[i+1]+In_String[i];
        destStr:=destStr+temp;
        inc(i,2);
      end;
    StrCopy(Result_Str,pchar(destStr));
    result:=true;
  end
else
  begin
    result:=false;
  end;
end;

</PRE></TD></TR>
        <TR>
          <TD align=right colSpan=4 height=10><FONT color=#ff6633><B><A 
            href="http://book.hackbase.com/ask24/how165085.htm#top"><FONT 
            color=#3366cc>Top</FONT></A></B></FONT></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD width=10 bgColor=#f1f5fa></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#3366cc>回复人:<B> 
            cg1120(代码最优化-§惟坚韧者始能遂其志§) </B></FONT><FONT color=#000000>( ) 信誉:252 
            </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>2003-02-13 
            15:19:50Z </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>得分:</FONT><FONT 
            color=#000000>0</FONT> </TD></TR>
        <TR>
          <TD bgColor=#0066cc colSpan=4 height=1></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR>
        <TR>
          <TD><FONT color=#ffffff>?</FONT></TD>
          <TD colSpan=3><PRE>
08 91 683108701305F0 11 00 0D 91 3176378290F9 00 00 00 02 C834
⑴08-短信息中心地址长度。指(91)+(683108701305F0)的长度。
⑵91-短信息中心号码类型。91是TON/NPI遵守International/E.164标准,指在号码前需加‘+’号;此外还有其它数值,但91最常用。
91-10010001
BIT No. 	7 	6 	5 	4 	3 	2 	1 	0 
Name 	1 	数值类型 	号码鉴别 
数值类型(Type of Number):000-未知,001-国际,010-国内,111-留作扩展;
号码鉴别(Numbering plan identification):0000-未知,0001-ISDN/电话号码(E.164/E.163),1111-留作扩展;
⑶683108701305F0-短信息中心号码。由于位置上略有处理,实际号码应为:8613800731500(字母F是指长度减1)。这需要根据不同的地域作相应的修改。
⑴、⑵、⑶通称短消息中心地址(Address of the SMSC)。
⑷11-文件头字节。
11&amp;h=00010001&amp;b
BIT No. 	7 	6 	5 	4 	3 	2 	1 	0 
Name 	TP-RP 	TP-UDHI 	TP-SPR 	TP-VFP 	TP-RD 	TP-MTI 
Value 	0 	0 	0 	1 	0 	0 	0 	1 
应答路径-TP-RP(TP-Reply-Path):0-不设置; 1-设置
用户数据头标识-TP-UDHL(TP-User-Data-Header-Indicator):0-不含任何头信息; 1-含头信息
状态报告要求-TP-SPR(TP-Status-Report-Request):0-需要报告; 1-不需要报告
有效期格式-TP-VPF(TP-Validity-Period-Format):00-不提供(Not present); 10-整型(标准);01-预留; 11-提供8位字节的一半(Semi-Octet Represented)
拒绝复制-TP-RD(TP-Reject-Duplicates):0-接受复制; 1-拒绝复制
信息类型提示-TP-MTI(TP-Message-Type-Indicator):00-读出(Deliver); 01-提交(Submit)
⑸00-信息类型(TP-Message-Reference)
⑹0B-被叫号码长度。
⑺91-被叫号码类型(同⑵)。
⑻3176378290F9-被叫号码,经过了位移处理,实际号码为“13677328099”。
⑹、⑺、⑻通称目的地址(TP-Destination-Address)。
⑼00-协议标识TP-PID(TP-Protocol-Identifier)
BIT No. 	7 	6 	5 	4 	3 	2 	1 	0 
Bit No.7与Bit No.6: 00-如下面定义的分配Bit No.0-Bit No.5;01-参见GSM03.40协议标识完全定义;10-预留;11-为服务中心(SC)特殊用途分配Bit No.0-Bit No.5。
一般将这两位置为00。
Bit No.5:0-不使用远程网络,只是短消息设备之间的协议;1-使用远程网络。
Bit No.0-Bits No.4:00000-隐含;00001-电传;00010-group 3 telefax;00100-语音;00101-欧洲无线信息系统(ERMES);00110-国内系统;10001-任何基于X.400的公用信息处理系统;10010-Email。
⑽00-数据编码方案TP-DCS(TP-Data-Coding-Scheme)
BIT No. 	7 	6 	5 	4 	3 	2 	1 	0 
Bit No.7与Bit No.6 :一般设置为00;Bit No.5:0-文本未压缩,1-文本用GSM标准压缩算法压缩;Bit No.4:0-表示Bit No.1、Bit No.0为保留位,不含信息类型信息,1-表示Bit No.1、Bit No.0含有信息类型信息;Bit No.3与Bit No.2:00-默认的字母表,01-8bit,10-USC2(16bit),11-预留;Bit No.1与Bit No.0:00-Class 0,01-Class 1,10-Class 2(SIM卡特定信息),11-Class 3。
⑾00-有效期TP-VP(TP-Valid-Period) 
VP value(&amp;h) 	相应的有效期 
00 to 8F 	(VP+1)*5 分钟 
90 to A7 	12小时+(VP-143)*30分钟 
A8 to C4 	(VP-166)*1天 
C5 to FF 	(VP-192)*1 周 
⑿02-用户数据长度TP-UDL(TP-User-Data-Length)
⒀C834-用户数据TP-UD(TP-User-Data)“Hi”



</PRE></TD></TR>
        <TR>
          <TD align=right colSpan=4 height=10><FONT color=#ff6633><B><A 
            href="http://book.hackbase.com/ask24/how165085.htm#top"><FONT 
            color=#3366cc>Top</FONT></A></B></FONT></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD width=10 bgColor=#f1f5fa></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#3366cc>回复人:<B> sysu(死树) 
            </B></FONT><FONT color=#000000>( ) 信誉:198 </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>2003-02-13 
            15:21:42Z </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>得分:</FONT><FONT 
            color=#000000>0</FONT> </TD></TR>
        <TR>
          <TD bgColor=#0066cc colSpan=4 height=1></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR>
        <TR>
          <TD><FONT color=#ffffff>?</FONT></TD>
          <TD colSpan=3><PRE>
几个方法:
1. 找网上的免费发短信的网站,用Http控件自己写表单提交,
   不过现在很难能找到免费发短信的网站了。
2. 跟移动/联通联系,他们提供短信网关的接口,你写程序
   连到他们的网关收发短信。前提是要申请到发短信的执照。
3. 通过你的手机发送,市场上有能通过手机发短信的设备,
   用它提供的API写程序。
</PRE></TD></TR>
        <TR>
          <TD align=right colSpan=4 height=10><FONT color=#ff6633><B><A 
            href="http://book.hackbase.com/ask24/how165085.htm#top"><FONT 
            color=#3366cc>Top</FONT></A></B></FONT></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD width=10 bgColor=#f1f5fa></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#3366cc>回复人:<B> 
            grail_(grail_) </B></FONT><FONT color=#000000>( ) 信誉:174 </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>2003-02-13 
            15:28:09Z </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>得分:</FONT><FONT 
            color=#000000>30</FONT> </TD></TR>
        <TR>
          <TD bgColor=#0066cc colSpan=4 height=1></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR>
        <TR>
          <TD><FONT color=#ffffff>?</FONT></TD>
          <TD colSpan=3><PRE>
首先通过下面的地址下载并安装微软SOAP工具包2.0:
  http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/001/580/msdncompositedoc.xml 
  然后就可以使用下面的简短代码发送SMS了。
  
  uses 
    ComObj; 
  
  procedure TForm1.Button1Click(Sender: TObject); 
  var 
    SoapClient: OleVariant; 
    v: OleVariant; 
  begin 
    SoapClient := CreateOleObject('MSSOAP.SoapClient'); 
    SoapClient.mssoapinit('http://sal006.salnetwork.com:83/lucin/smsmessaging/process.xml'); 
    SoapClient.SendTextMessage('Number', 'MessageBody', 'Sender'); 
  end; 
  
  其中Number为国家代码+电话号码(不需要以零打头),
  如 06 12345678 在荷兰:31612345678
  (有些可惜,上面的网址不能发中国的手机
</PRE></TD></TR>
        <TR>
          <TD align=right colSpan=4 height=10><FONT color=#ff6633><B><A 
            href="http://book.hackbase.com/ask24/how165085.htm#top"><FONT 
            color=#3366cc>Top</FONT></A></B></FONT></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD width=10 bgColor=#f1f5fa></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#3366cc>回复人:<B> 
            bluenightsky() </B></FONT><FONT color=#000000>( ) 信誉:78 </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>2003-02-13 
            15:42:25Z </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>得分:</FONT><FONT 
            color=#000000>0</FONT> </TD></TR>
        <TR>
          <TD bgColor=#0066cc colSpan=4 height=1></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR>
        <TR>
          <TD><FONT color=#ffffff>?</FONT></TD>
          <TD colSpan=3><PRE>
学习
</PRE></TD></TR>
        <TR>
          <TD align=right colSpan=4 height=10><FONT color=#ff6633><B><A 
            href="http://book.hackbase.com/ask24/how165085.htm#top"><FONT 
            color=#3366cc>Top</FONT></A></B></FONT></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD width=10 bgColor=#f1f5fa></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#3366cc>回复人:<B> 
            ssh78(虹彩妹妹) </B></FONT><FONT color=#000000>( ) 信誉:100 </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>2003-02-13 
            16:33:31Z </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>得分:</FONT><FONT 
            color=#000000>0</FONT> </TD></TR>
        <TR>
          <TD bgColor=#0066cc colSpan=4 height=1></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR>
        <TR>
          <TD><FONT color=#ffffff>?</FONT></TD>
          <TD colSpan=3><PRE>
看到这么多贴子真高兴啊
</PRE></TD></TR>
        <TR>
          <TD align=right colSpan=4 height=10><FONT color=#ff6633><B><A 
            href="http://book.hackbase.com/ask24/how165085.htm#top"><FONT 
            color=#3366cc>Top</FONT></A></B></FONT></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD width=10 bgColor=#f1f5fa></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#3366cc>回复人:<B> 
            hjb8000(北极熊) </B></FONT><FONT color=#000000>( ) 信誉:100 </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>2003-02-13 
            17:25:03Z </FONT></TD>
          <TD bgColor=#f1f5fa height=25><FONT color=#000000>得分:</FONT><FONT 
            color=#000000>0</FONT> </TD></TR>
        <TR>
          <TD bgColor=#0066cc colSpan=4 height=1></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR>
        <TR>
          <TD><FONT color=#ffffff>?</FONT></TD>
          <TD colSpan=3><PRE>
你买一个无线MODEM,手册中提供详细方法,包括用标准AT指令和用TAPI函数的,
价格在1500左右!!
</PRE></TD></TR>
        <TR>
          <TD align=right colSpan=4 height=10><FONT color=#ff6633><B><A 
            href="http://book.hackbase.com/ask24/how165085.htm#top"><FONT 
            color=#3366cc>Top</FONT></A></B></FONT></TD></TR>
        <TR>
          <TD colSpan=4 height=5></TD></TR></TBODY></TABLE></TD></TR>
  <TR>
    <TD>
      <TABLE cellSpacing=0 cellPadding=0 width=580 border=0>
        <TBODY>
        <TR>
          <TD width="100%" bgColor=#999999 height=1></TD></TR>
        <TR>
          <TD width="100%"><BR>结贴 ,得分记录: cg1120 (70)、 grail_ (30)、 </TD></TR>
        <TR>
          <TD width="100%" 
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></CENTER>
<SCRIPT type=text/javascript><!--google_ad_client = "pub-7325395580237867";google_ad_width = 160;google_ad_height = 90;google_ad_format = "160x90_0ads_al_s";google_ad_channel ="";//--></SCRIPT>

<SCRIPT src="怎样做一个给手机发送短信的程序?.files/ad.htm" type=text/javascript></SCRIPT>

<SCRIPT language=javascript src="怎样做一个给手机发送短信的程序?.files/record.php.htm" 
type=text/javascript></SCRIPT>
<!--#include file="/footer.htm"--></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -