delphi7http服务器(delphi7汇编语言dos)

  Delphi是美国Borland(宝兰)公司开辟的工作在Windows平台下的开辟工具,它的前身是在DOS下的产物BorlandTurboPascal。从产物名称上就可以知道,TurboPascal利用的是Pascal语言。从TurboPascal5.5版本开始,Borland公司在传统Pascal的底子上参加了面向对象的功能。

  DelphiXE|Delphi7短信验证码接口发送DEMO

  其他语言接口下载(完备版):https://www.bonzson.net/page.php?cid=1482

  以下是部分代码片断:

  programSendSmsDemo;

  uses

  Forms,

  frmMainUnitin'frmMainUnit.pas'{frmMain};

  {$R*.res}

  begin

  Application.Initialize;

  Application.Title:='SendSmsDemo';

  Application.CreateForm(TfrmMain,frmMain);

  Application.Run;

  end.

  以下是Delphi7代码片断:

  unitfrmMainUnit;

  interface

  uses

  Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,

  Dialogs,IdBaseComponent,IdComponent,IdTCPConnection,IdTCPClient,

  IdHTTP,StdCtrls,ComCtrls;

  type

  TfrmMain=class(TForm)

  Button1:TButton;

  Button2:TButton;

  Button3:TButton;

  CheckBox1:TCheckBox;

  DateTimePicker1:TDateTimePicker;

  DateTimePicker2:TDateTimePicker;

  Label1:TLabel;

  Label2:TLabel;

  Memo1:TMemo;

  Edit1:TEdit;

  Label3:TLabel;

  Edit2:TEdit;

  Label4:TLabel;

  IdHTTP1:TIdHTTP;

  StaticText1:TStaticText;

  procedureButton1Click(Sender:TObject);

  procedureButton2Click(Sender:TObject);

  procedureButton3Click(Sender:TObject);

  procedureFormCreate(Sender:TObject);

  private

  {Privatedeclarations}

  public

  {Publicdeclarations}

  end;

  var

  frmMain:TfrmMain;

  implementation

  {$R*.dfm}

  useshttpapp;

  procedureTfrmMain.Button1Click(Sender:TObject);

  var

  vParam:TStringList;

  begin//验证帐号

  vParam:=TStringList.Create;

  try

  vParam.Add('id=test');

  vParam.Add('pwd=test');

  vParam.Add('cmd=1');

  IdHTTP1.Request.AcceptCharSet:='utf8';

  IdHTTP1.Request.ContentType:='application/x-www-form-urlencoded';

  Edit2.Text:=IdHTTP1.Post('https://ls5588.vicp.cc:8090',vParam);

  finally

  vParam.Free;

  end;

  end;

  procedureTfrmMain.Button2Click(Sender:TObject);

  var

  vParam:TStringList;

  begin//查询余额

  vParam:=TStringList.Create;

delphi7http服务器(delphi7汇编语言dos) delphi7http服务器(delphi7汇编语言dos) 行业资讯

  try

  vParam.Add('id=test');

  vParam.Add('pwd=test');

delphi7http服务器(delphi7汇编语言dos) delphi7http服务器(delphi7汇编语言dos) 行业资讯

  vParam.Add('cmd=2');

  IdHTTP1.Request.AcceptCharSet:='utf8';

  IdHTTP1.Request.ContentType:='application/x-www-form-urlencoded';

  Edit2.Text:=IdHTTP1.Post('https://ls5588.vicp.cc:8090',vParam);

  finally

  vParam.Free;

  end;

  end;

  procedureTfrmMain.Button3Click(Sender:TObject);

  var

  vParam:TStringList;

  begin//发送短信

  vParam:=TStringList.Create;

  try

  vParam.Add('id=test');

  vParam.Add('pwd=test');

  vParam.Add('content='+HTTPEncode(Memo1.Lines.Text));

  vParam.Add('mobile='+HTTPEncode(Edit1.Text));

  ifCheckBox1.Checkedthen

  begin

  vParam.Add('sendtime='

  +formatdatetime('yyyyMMdd',DateTimePicker1.Date)

  +formatdatetime('HHmmss',DateTimePicker2.Time));

  end

  else

  vParam.Add('sendtime=0');

  IdHTTP1.Request.AcceptCharSet:='utf8';

  IdHTTP1.Request.ContentType:='application/x-www-form-urlencoded';

  Edit2.Text:=IdHTTP1.Post('https://ls5588.vicp.cc:8090',vParam);

  finally

  vParam.Free;

  end;

  end;

  procedureTfrmMain.FormCreate(Sender:TObject);

  begin

  DateTimePicker1.DateTime:=now;

  DateTimePicker2.DateTime:=now;

  end;

  end.

客户评论

我要评论