Ver Mensaje Individual
  #12  
Antiguo 02-11-2006
tefots tefots is offline
Miembro
 
Registrado: feb 2005
Posts: 108
Reputación: 20
tefots Va por buen camino
volviendo al tema

aqui pongo un ejemplo de como hacer un post usando las indy.
creo que es mas sencillo que usando las wininet.

el get seria parecido.


Código Delphi [-]
procedure TForm1.SendPostData;
Var
  aStream: TMemoryStream;
  Params: TStringStream;
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'));
      Request.ContentType := 'application/x-www-form-urlencoded';
      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;
Responder Con Cita