> Hi Doychin,
> Do you know anything about that (random) number in the boundary part. Are
> there any limits whitin it must be or is it just a 14 digit hex number
> 000000000000000 to FFFFFFFFFFFFFF or does it have to be in a specific
range?
> If so, any ideas of how to generate one in delphi ?
> /David
> Doychin Bondzhev <doic...@5group.com> wrote in message
> news:3a39d1d8_2@dnews...
> > This is a small exaple of using post to send data to web server.
> > There is two different ways to do this operation.
> > Example 1:
> > <----------------------------------------------------------------->
> > procedure TForm1.SendPostData;
> > Const
> > CRLF = #13#10;
> > Var
> > aStream: TMemoryStream;
> > Params: TMemoryStream;
> > S: String;
> > begin
> > aStream := TMemoryStream.create;
> > Params := TMemoryStream.Create;
> > HTTP.Request.ContentType := 'multipart/form-data;
> > boundary=-----------------------------7cf87224d2020a';
> > try
> > S := '-----------------------------7cf87224d2020a' + CRLF +
> > 'Content-Disposition: form-data; name="sys_return_url"' + CRLF +
> CRLF
> > +
> > 'hello' + CRLF +
> > '-----------------------------7cf87224d2020a--';
> > Params.Write(S[1], Length(S));
> > with HTTP do begin
> > try
> > HTTP.Post('http://www.mydomain.com/postexampe.cgi', Params,
> > aStream);
> > except
> > on E: Exception do
> > showmessage('Error encountered during POST: ' + E.Message);
> > end;
> > end;
> > aStream.WriteBuffer(#0' ', 1);
> > showmessage(PChar(aStream.Memory));
> > except
> > end;
> > end;
> > <----------------------------------------------------------------->
> > Example 2:
> > <----------------------------------------------------------------->
> > procedure TForm1.SendPostData;
> > Var
> > aStream: TMemoryStream;
> > Params: TStrings;
> > begin
> > aStream := TMemoryStream.create;
> > Params := TStringlist.create;
> > HTTP.Request.ContentType := 'application/x-www-form-urlencoded';
> > try
> > Params.add('sys_return_url=' + 'helo');
> > with HTTP do begin
> > try
> > HTTP.Post('http://www.mydomain.com/postexampe.cgi', Params,
> > aStream);
> > except
> > on E: Exception do
> > showmessage('Error encountered during POST: ' + E.Message);
> > end;
> > end;
> > aStream.WriteBuffer(#0' ', 1);
> > showmessage(PChar(aStream.Memory));
> > except
> > end;
> > end;
> > <----------------------------------------------------------------->
> > As you can see there is a difference in the way post stream is
constructed
> > and the ContentType. In the first example ContentType is
> > "multipart/form-data;
> boundary=-----------------------------7cf87224d2020a"
> > and this boundary is used to separate different parameters.
> > In the second example the ContentType is
> > "application/x-www-form-urlencoded".
> > In this case the paremeteras are passed in the form
> > ParamName=ParamValue
> > and each line is different parameter.
> > Where these two formats of post information are used?
> > The first one is used when you have binary data to post and the second
one
> > is when you are going to post only text fields.
> > If you have any questions please fill free to send me e-mail or post
them
> on
> > this newsgroup.
> > Doychin
> > doic...@5group.com