BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Running Idhttp->Post

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
JoeAley2003
Guest





PostPosted: Sat Dec 27, 2003 5:08 am    Post subject: Running Idhttp->Post Reply with quote



Hi all.

I found this sample on the web and it doesn't compile on kylix
because URLEncode() was not found, so taking a look at help, i found
this function on TIdURI type. Now it compiles but don't run because of
a 'protocol field is empty' excpetion generated on the first line of
try... Params.WriteString(...
I don't know because as you can see, i have setted up the field in
the code and at the component.

////----------
Var
aStream: TMemoryStream;
Params: TStringStream;

begin
aStream := TMemoryStream.create;
Params := TStringStream.create('');
HTTP.Request.ContentType := 'application/x-www-form-urlencoded';
HTTP.ProtocolVersion := pv1_1;

try
Params.WriteString(TIdURI.URLEncode('login=' + 'teste (AT) teste (DOT) com' +
'&'));
Params.WriteString(TIdURI.URLEncode('password=""');

with HTTP do begin
try
HTTP.Post('http://www.mysite.com/cgi-bin/" name="login',
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;
///////------------------------


Does someone has a working code different from this???
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.