Re: Post examples

Giganews Newsgroups
Subject: Re: Post examples
Posted by:  Remy Lebeau (TeamB) (
Date: Thu, 30 Mar 2006

"Mack" <moc_tod_liamtoh_@_kcam> wrote in message

> I am new to Indy and have only just begun to use it.  I need
> examples on how to post form data to a server and get the response.

That depends on what the server is actually expecting as input to begin
with.  There are two possibilities:

1) the server is expecting data in "multipart/form-data" format.  Use the
TIdMultiPartFormDataStream class for that.

2) the server is expecting data in "application/x-www-form-urlencoded"
format.  Put the values into a TStringList instead, in "name=value" items.

The type of format expected by the server is specified in the "enctype"
attribute of the HTML's <form> tag.  If the "enctype" attribute is not
present than "application/x-www-form-urlencoded" is used.

TIdHTTP has overloaded versions of its Post() method for both scenerios
(which can only be used if the <form> tag's "method" attribute is set to




In response to

Post examples posted by Mack on Thu, 30 Mar 2006