Sta*_*lin 2 delphi console indy
我使用了 TStringList 和类似的东西:
geo: TStringList;
response: TStringStream;
begin
http:=tidhttp.Create(nil);
try
{ TODO -oUser -cConsole Main : Insert code here }
geo:=TStringList.Create;
response:=TStringStream.Create('');
geo.Add('name=stas');
geo.Add('pass=431');
s:=http.Get('http://test.me');
writeln(http.ResponseText);
writeln(s);
s:=http.Post('http://test.me',geo,response);
Run Code Online (Sandbox Code Playgroud)
但有些不对劲。例如,当我运行它时,它会发出警报并[[DCC Error] consoleHttp.dpr(29): E2010 Incompatible types: 'string' and 'procedure, untyped pointer or untyped parameter']显示s:=http.Post('http://test.me',geo,response). 我做错了什么?
此错误意味着您向该方法传递了错误的参数TIdHTTP.post。这个方法有几个重载
function Post(AURL: string; ASource: TIdStrings): string; overload;
function Post(AURL: string; ASource: TIdStream): string; overload;
function Post(AURL: string; ASource: TIdMultiPartFormDataStream): string; overload;
procedure Post(AURL: string; ASource: TIdMultiPartFormDataStream; AResponseContent: TIdStream); overload;
procedure Post(AURL: string; ASource: TIdStrings; AResponseContent: TIdStream); overload;
procedure Post(AURL: string; ASource, AResponseContent: TIdStream); overload;
Run Code Online (Sandbox Code Playgroud)
但没有一个与您传递的参数匹配。
| 归档时间: |
|
| 查看次数: |
10056 次 |
| 最近记录: |