2

I used TStringList and something that looks like:

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);

but something is wrong. For example when I run it it's alerting with the error [[DCC Error] consoleHttp.dpr(29): E2010 Incompatible types: 'string' and 'procedure, untyped pointer or untyped parameter'] in s:=http.Post('http://test.me',geo,response). What did I do wrong?

2
  • exactly, it is no need to use third parametr. Commented Nov 18, 2011 at 2:23
  • It seems he might think that the geo stuff is some http-headers and response is the response? Commented Nov 18, 2011 at 2:43

2 Answers 2

5

This error means which you are passing wrong parameters to the method TIdHTTP.post. this method has several overloads

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;

but none match with the parameters which you are passing.

Sign up to request clarification or add additional context in comments.

Comments

4

do this:

http.Post('http://test.me',geo,response);

instead of:

s:=http.Post('http://test.me',geo,response);

The only matching method is a procedure, but procedures don't return values. The error message is saying that you can't assign a procedure to a string.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.