unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, IdHTTP, IdURI, Httpapp, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } function httpPost(postUrl:String;Params:TStrings):string; end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var url : string; username : string; password,apikey,mobile,content,encode,str : string; Params: TStrings; i :Integer; begin //實例:http://sms.106jiekou.com/utf8/sms.aspx?account=用戶賬號&password=接口密碼&mobile=號碼&content=您的訂單編碼:888888。如需幫助請聯(lián)系客服。 Params := TStringList.Create; username := ''; //用戶名 password := ''; //接口密碼 mobile :=''; //手機號,只發(fā)一個號碼:158xxxxxxxx。 content := UTF8Encode('您的訂單編碼:7231。如需幫助請聯(lián)系客服。'); //要發(fā)送的短信內(nèi)容,特別注意:簽名必須設(shè)置,網(wǎng)頁驗證碼應(yīng)用需要加添加【圖形識別碼】以防被短信攻擊 //ShowMessage(content); Params.Add('account='+username) ; Params.Add('password='+password) ; Params.Add('mobile='+mobile) ; Params.Add('content='+content) ; url := 'http://sms.106jiekou.com/utf8/sms.aspx?'; ShowMessage(httpPost(url,Params)); //要發(fā)送的URL鏈接與內(nèi)容。 Params.Free; end; function TForm1.httpPost(postUrl:string;Params:TStrings):string; var idhtp1: TIdHTTP; begin idhtp1:= TidHTTp.create(self); idhtp1.AllowCookies:=True; idhtp1.HTTPOptions:=[hoForceEncodeParams]; idhtp1.ProtocolVersion:=pv1_1; idhtp1.Request.ContentType:='application/x-www-form-urlencoded'; idhtp1.Request.CacheControl:='no-cache'; idhtp1.Request.UserAgent:='User-Agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1'; idhtp1.Request.Accept:='Accept=textml,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'; idhtp1.Request.AcceptEncoding:='Accept-Encoding=gzip,deflate'; idhtp1.Request.AcceptCharSet:='Accept-Charset=gb2312,utf-8;q=0.7,*;q=0.7'; idhtp1.Request.Connection:='Connection=keep-alive'; try result := idhtp1.Post(postUrl,Params); except Result := 'error'; end; end; end.
友情鏈接:106短信平臺 | 發(fā)短信平臺 | 短信接口平臺 | 短信接口平臺哪個好 | 國際短信 | 短信通 | 短信接口應(yīng)用
關(guān)于我們 | 產(chǎn)品與服務(wù) | 解決方案 | 客戶案例 | 聯(lián)系我們 | 幫助指南 | 付款方式
Copyright © 2008-2018 短信通 . 速度網(wǎng)絡(luò)有限公司 短信接口應(yīng)用第一平臺 All rights reserved. 浙ICP備10040624號-2