idhttp post 如何登陆百度?就是想 用 post 登陆 一个有用户名的网站例如百度 请给个例子 高分请教

解决方案 »

  1.   


    function GetHtml(Url: string; Source: TStringList): integer; 
    var 
      IdHTTP: TIdHTTP; 
      Ans: string; 
    begin 
      Result := 0; 
      IdHTTP := TIdHTTP.Create(nil); 
      try 
        try 
          Ans := IdHTTP.Post(Url, Source); 
          Result := Length(Ans); 
          ShowMessage(Ans); 
        except 
          on E: Exception do 
          begin 
            // 
          end; 
        end; 
      finally 
        IdHTTP.Free; 
      end; 
    end;var
      Source: TStringList;
    begin
      Source := TStringList.Create;
      try
        Source.add('userid=xxx');
        Source.add('password=xxx');
        GetHtml('www.xxxx.com', Source);
      finally
        Source.Free;
      end;
    end;