如何用delphi7获得外部IP请高手指点

解决方案 »

  1.   

    function TForm1.GetWanIP;
    begin
      NMHTTP1.InputFileMode := FALSE;
      NMHTTP1.OutputFileMode := FALSE;
      NMHTTP1.ReportLevel := Status_Basic;  NMHTTP1.Get('http://web/getip.asp'); { 获取网站文本 }
      Result:=NMHTTP1.Body;
    end;
    ------getip.asp 片段------
    ...
    userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
    If userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR") 
    response.write userip
      

  2.   

    第一句应该是:function TForm1.GetWanIP:string;