http://218.22.46.190:8099/service/XChangeServlet?account=02&receiver=02 这个是地址 下面是我做的小例子,但是总是提示连不上,求帮忙?请大家一定帮帮忙啊, 或者有类似的例子也行啊。object Form1: TForm1
Left = 192
Top = 130
Width = 979
Height = 563
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 160
Top = 120
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object Button2: TButton
Left = 344
Top = 112
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 0
OnClick = Button2Click
end
object IdHTTP1: TIdHTTP
MaxLineAction = maException
ReadTimeout = 0
AllowCookies = True
ProxyParams.BasicAuthentication = False
ProxyParams.ProxyPort = 0
Request.ContentLength = -1
Request.ContentRangeEnd = 0
Request.ContentRangeStart = 0
Request.ContentType = 'text/html'
Request.Accept = 'text/html, */*'
Request.BasicAuthentication = False
Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
HTTPOptions = [hoForceEncodeParams]
Left = 208
Top = 72
end
endunit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP, StdCtrls;type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
strUrl, strPath: string;
resqM, responseM: TmemoryStream;
begin
strUrl := 'http://218.22.46.190:8099/service/XChangeServlet?account=01&receiver=01';
strPath := ExtractFilePath(Application.ExeName);
resqM := TmemoryStream.Create;
responseM := TmemoryStream.Create;
try
//IdHTTP1.URL := strUrl;
//IdHTTP1.Request.ContentType := '"text/xml"';
//IdHTTP1.Request.ContentLength :=
//IdHTTP1.Request.Method := hmPost;
resqM.LoadFromFile( strPath + '20130925191904.xml');
IdHTTP1.Post(strUrl, resqM, responseM); responseM.SaveToFile('D:\11.xml');
finally
resqM.Free;
responseM.Free;
end;
end;procedure TForm1.Button2Click(Sender: TObject);
var
strUrl: string;
Params: TStrings;
begin
strUrl := 'http://218.22.46.190:8099/service/XChangeServlet?account=02&receiver=02';
Params := TStringList.Create; try
//Params.Add('account=01');
//Params.Add('receiver=01');
//IdHTTP1.URL := strUrl;
IdHTTP1.Request.ContentType := '"text/xml"';
//IdHTTP1.Request.ContentLength :=
IdHTTP1.Request.Method := hmPost;
IdHTTP1.Post(strUrl, Params);
finally
Params.Free;
end;
end;end.
Left = 192
Top = 130
Width = 979
Height = 563
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 160
Top = 120
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object Button2: TButton
Left = 344
Top = 112
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 0
OnClick = Button2Click
end
object IdHTTP1: TIdHTTP
MaxLineAction = maException
ReadTimeout = 0
AllowCookies = True
ProxyParams.BasicAuthentication = False
ProxyParams.ProxyPort = 0
Request.ContentLength = -1
Request.ContentRangeEnd = 0
Request.ContentRangeStart = 0
Request.ContentType = 'text/html'
Request.Accept = 'text/html, */*'
Request.BasicAuthentication = False
Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
HTTPOptions = [hoForceEncodeParams]
Left = 208
Top = 72
end
endunit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP, StdCtrls;type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
strUrl, strPath: string;
resqM, responseM: TmemoryStream;
begin
strUrl := 'http://218.22.46.190:8099/service/XChangeServlet?account=01&receiver=01';
strPath := ExtractFilePath(Application.ExeName);
resqM := TmemoryStream.Create;
responseM := TmemoryStream.Create;
try
//IdHTTP1.URL := strUrl;
//IdHTTP1.Request.ContentType := '"text/xml"';
//IdHTTP1.Request.ContentLength :=
//IdHTTP1.Request.Method := hmPost;
resqM.LoadFromFile( strPath + '20130925191904.xml');
IdHTTP1.Post(strUrl, resqM, responseM); responseM.SaveToFile('D:\11.xml');
finally
resqM.Free;
responseM.Free;
end;
end;procedure TForm1.Button2Click(Sender: TObject);
var
strUrl: string;
Params: TStrings;
begin
strUrl := 'http://218.22.46.190:8099/service/XChangeServlet?account=02&receiver=02';
Params := TStringList.Create; try
//Params.Add('account=01');
//Params.Add('receiver=01');
//IdHTTP1.URL := strUrl;
IdHTTP1.Request.ContentType := '"text/xml"';
//IdHTTP1.Request.ContentLength :=
IdHTTP1.Request.Method := hmPost;
IdHTTP1.Post(strUrl, Params);
finally
Params.Free;
end;
end;end.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货