Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Oct : Post to textarea (multiline) using IdHTTP?

www.cryer.info
Managed Newsgroup Archive

Post to textarea (multiline) using IdHTTP?

Subject:Post to textarea (multiline) using IdHTTP?
Posted by:"Marko" (marko12..@fastmail.fm)
Date:8 Oct 2005 15:08:17

Hello,

I need to post data to a secure form which has a textarea, multiline input field. I tried with a regular form (I think that this has nothing to do with http(s) though) with single-line input field and it works. With textarea however, I'm stuck. Here's my code that only returns me the original page with empty field (keywords is the name of the textarea):

procedure TForm1.Button1Click(Sender: TObject);
var
  postData: TStringList;
  response: TStringStream;
begin
  postData := TStringList.Create;
  response := TStringStream.Create('');

  postData.Add('keywords=some+input');

  IdHTTP.IOHandler := IdSSLIOHandlerSocket;
  IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded';

  try
   IdHTTP.Post('https://adwords.google.com/select/KeywordSandbox',
                postData, response);
    memo1.Text := 'Response: ' + #13#10 + response.DataString;
  finally
    postData.Free;
    response.Free;
  end;
end;

I'm using D7 and Indy 9.

Marko

Replies:

www.cryer.info
Managed Newsgroup Archive