Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post text to a web server

Status
Not open for further replies.

iperich

Programmer
Nov 17, 2005
2
US
Hi, Im trying to post information to a web server through a Delphi app. I'm using the Indy components, to a very simple php page :
echo '$algo1<br>';echo '$algo2<br>'

And i have this Delphi code:


aStream := TMemoryStream.create;
Params := TStringStream.create('');

HTTP.Request.ContentType := 'application/x- Params.WriteString(('algo1=something'));
Params.WriteString(('algo2=otherstuff'));
try

with HTTP do begin
try
HTTP.Post(' 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;

I only receive a "<br><br>" as a response from the php. I tried also with Params.WriteString(('algo1=something&algo2=otherstuff'));

and doesn't work.

Am I doing something wrong?
Ah, and other stuff: I want to post a big amount of data to a web server and the app sendme the error "Connection closed gracefully" what does it mean? (I don't find it graceful)

Thanks in advice

Ivo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top