本帖最后由 l2walker 于 2010-04-28 09:49:39 编辑

解决方案 »

  1.   

    运行过程也正常,没出现什么问题 ... 可oHtml值始终为空,第一次oHtml值正常 ... 之后,第二次 .. 第三次 ... 第N次,oHtml值均为空;但我用HTTPLook监视时,aIdHTTP.Get('http://www.xxx.com/ooo/?page='+IntToStr(eax),ResponseGet) 每次都正常取得值了的;
    可程序中的 oHtml 值始终为空 ... 不知道哪出错了..
      

  2.   

    一般来说。GET后需要disconnect .POST 最好不要disconnect
      

  3.   


    加了aIdHttp.Disconnect后,我每个.Get()后都加了,问题依旧 .. 晕
    是不是我把aIdHttp.Disconnect位置加错了呢?我刚学一点点delphi,非coder;补充,其中后面代码中还用到 aIdHTTP.get(...) 和 aIdHTTP.post(...) ,如下:procedure TForm1.Timer1Timer(Sender: TObject);
    var
      aPostData,eUrlList,eeUrlList,atmp:TStringList;
      aResponseData:TStringStream;
      oHtml,tmp,eID,eUrl,eTitle:string;
      ResponseGet:TStringStream;
      ea,et,eax:integer;
      FirstTickCount,MSecs, Now: Longint;beginTimer1.Enabled:=false;atmp:=TStringList.Create;
    eUrlList:=TStringList.Create;
    eeUrlList:=TStringList.Create;for eax := 1 to 9 do
      begin  if Assigned(ResponseGet) then FreeAndNil(ResponseGet);
      ResponseGet:=TStringStream.Create('');
      aIdHTTP.Request.Host:='http://www.xxx.com/ooo/';
      if eax=1 then
      begin
      aIdHTTP.Request.Referer:='http://www.xxx.com/'; //aIdHTTP是全局变量
      aIdHTTP.Get('http://www.xxx.com/ooo/',ResponseGet);
      end
      else
      begin
      aIdHTTP.Request.Referer:='http://www.xxx.com/ooo/?page='+IntToStr(eax-1);
      aIdHTTP.Get('http://www.xxx.com/ooo/?page='+IntToStr(eax),ResponseGet);
      end;  oHtml:= UTF8Decode(ResponseGet.DataString);
      showmessage(oHtml); // 这里timer运行第二次时,oHtml为空;
      ....................
      aIdHTTP.get(...)  ; // 这里这里
      ....................
      aIdHTTP.post(...) ; // 这里这里
      ....................
      end;  Timer1.Enabled:=true;
    end;
      

  4.   

    加了aIdHttp.Disconnect后,我每个.Get()后都加了????是不是位置不对呀,之后加,那不还是什么都没有吗,Get之前加
      

  5.   

    前后,我都试了 ... 还是不行;
    放在后面,数据不是已经get到 ResponseGet 中了吗?
      

  6.   

    结了,是IDHttp的问题,最终,我把它Freeandnil(aIDHttp)掉再create后,就正常了;