> I'm using components HTTPCli and FTPCli. I have no troubles with
> the second one. But i have a question about HTTPCli. How could i send
> some values to a specified parameters using POST method?

Basically, you build a TStream with the data formatted as your server expect
it (urlencoded, mime,...).
Then you supply that stream to the HTTP component before call post.

Here is an extract from HttpPg demo delivered with ICS-V5. In that demo, the
server expect data in urlencoded format. btw: Not sure the server still
exists !

procedure THttpTestForm.SendButtonClick(Sender: TObject);
var
    DataIn  : TMemoryStream;
    DataOut : TMemoryStream;
    Buf     : String;
begin
    DisplayMemo.Clear;
    DataIn  := TMemoryStream.Create;  { For the response        }
    DataOut := TMemoryStream.Create;  { For the data to be sent }
    try
        { Build the data to be sent to the CGI. }
        Buf     := 'ID=' + Encode(UserIDEdit.Text) +
                   '&REMITE=' + Encode(EMailEdit.Text) +
                   '&MENSAJE=' + Encode(MessageEdit.Text);
        { Write the data to the stream which will be used to send }
        DataOut.Write(Buf[1], Length(Buf));
        { Position the stream at the beginning or nothing will be sent }
        DataOut.Seek(0, soFromBeginning);

        { Setup the HTTP component to transmit }
        httpcli1.SendStream := DataOut;
        httpcli1.RcvdStream := DataIn;
        httpcli1.Proxy      := ProxyEdit.Text;
        httpcli1.ProxyPort  := '80';
        HttpCli1.URL        := 'http://www.unired.net.pe/cgi-bin/a.out';

        SendButton.Enabled  := FALSE;
        AbortButton.Enabled := TRUE;
        try
            try
                httpcli1.Post;
                { Data sent, copy the webserver response to the
DisplayMemo }
                DataIn.Seek(0, 0);
                DisplayMemo.Lines.LoadFromStream(DataIn);
            except
                { An error occured ! }
                DisplayMemo.Lines.Add('Failed : ' + HttpCli1.ReasonPhrase);
                raise
            end;
        finally
            SendButton.Enabled  := TRUE;
            AbortButton.Enabled := FALSE;
        end;
    finally
        DataOut.Free;
        DataIn.Free;
    end;
end;

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to