Unit1.pas 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. unit Unit1;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, StdCtrls, ExtCtrls,comobj; // 注意要引用 uses comobj;
  6. type
  7. TForm1 = class(TForm)
  8. GroupBox2: TGroupBox;
  9. btxt: TMemo;
  10. Label4: TLabel;
  11. content: TMemo;
  12. mob: TMemo;
  13. Label5: TLabel;
  14. Label6: TLabel;
  15. Label7: TLabel;
  16. GroupBox3: TGroupBox;
  17. pwd: TEdit;
  18. Label3: TLabel;
  19. uid: TEdit;
  20. Label2: TLabel;
  21. Button2: TButton;
  22. procedure Button2Click(Sender: TObject);
  23. private
  24. { Private declarations }
  25. public
  26. { Public declarations }
  27. end;
  28. var
  29. Form1: TForm1;
  30. implementation
  31. {$R *.dfm}
  32. //_________________________________HTTP通信函数返回信息
  33. function HTTPwebservice(url:string):string;
  34. var
  35. responseText: WideString;
  36. xmlHttp: OLEVariant;
  37. begin
  38. try
  39. xmlHttp:=CreateOleObject('Msxml2.XMLHTTP');
  40. xmlHttp.open('GET',url,false);
  41. xmlHttp.send();
  42. responseText:=xmlHttp.responseText;
  43. if xmlHttp.status='200' then
  44. begin
  45. HTTPwebservice:=responseText;
  46. end;
  47. xmlHttp := Unassigned;
  48. except
  49. exit;
  50. end;
  51. end;
  52. //______________________________
  53. procedure TForm1.Button2Click(Sender: TObject);
  54. var
  55. bdata,mobstr:string;
  56. begin
  57. mobstr:=stringreplace(mob.Text,#10,',',[rfReplaceAll]);
  58. bdata:=HTTPwebservice('http://service.winic.org/sys_port/gateway/?id='+uid.Text+'&pwd='+pwd.Text+'&to='+mobstr+'&content='+content.Text+'&time=');
  59. btxt.Lines.Append(bdata);
  60. end;
  61. end.