Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2003, 07:41 AM
RickySan RickySan is offline
Senior Member
 
Join Date: Jan 2001
Posts: 140
Default HTTP post

Hi

anyone have any examples of a HTTP post action and the result coming back from the server, i need to post stuff in the header as well (content length etc.

Ricky
Reply With Quote
  #2  
Old 08-19-2003, 12:14 AM
Ted On The NeT Ted On The NeT is offline
Senior Member
 
Join Date: Apr 2001
Posts: 2,182
Default RE: HTTP post

Have a look at the INDY components. there are a lot of examples, which can be found at www.atozedsoftware.com


Regards,
::TeD On The NeT::

=[ QUESTIONS ]==========================================
please click Accept as Answer if my reply helped you.

=[ EXTRA INFO ]=========================================
Location : Netherlands (GMT +01.00)
Languages : English, Dutch, German
Age : 26
--------------------------------------------------------
Used OS : Win2k SR4 | Win2k SR4
Delphi # : Enterprise 5 SP2 | Professional/Enterprise 7
================================================== ======
Reply With Quote
  #3  
Old 08-19-2003, 07:08 AM
RickySan RickySan is offline
Senior Member
 
Join Date: Jan 2001
Posts: 140
Default RE: HTTP post

Mogge Ted,

Nice info on that site, but i'm looking for post examples I have to change header information before i can post to a server and then i'll get a response back from the server.

I'll keep slugging along

Groeten,
RickySan
Reply With Quote
  #4  
Old 08-19-2003, 01:38 PM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default RE: HTTP post

Try this

procedure TForm1.SendPostData;
Var
aStream: TMemoryStream;
Params: TStringStream;
InternalHeaders: TIdHeaderList;
begin
aStream := TMemoryStream.create;
Params := TStringStream.create('');

try
with IdHTTP1 do
begin
Params.WriteString(URLEncode('teste=' + 'yes' + '&'));
Params.WriteString(URLEncode('name=' + 'ivan' + '&'));
Params.WriteString(URLEncode('number=' + '102'));
// You can change headers like this:
Request.ContentType := 'application/x-www-form-urlencoded';
// or set customheaders like this:
InternalHeaders := TIdHeaderList.Create;
InternalHeaders.Add ('User-Agent: WebTV');
Request.SetExtraHeaders(InternalHeaders);
InternalHeaders.Free;
try
Post('http://localhost/teste.asp', Params, aStream);
except
on E: Exception do
showmessage('Error encountered during POST: ' + E.Message);
end;
end;
aStream.WriteBuffer(#0' ', 1);
aStream.Position := 0;
Memo1.Lines.LoadFromStream(aStream);
except
end;
end;


Confusious say:
Never stand between fire hydrant and dog.

MB34
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:00 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.