 
var
  KeyWord:string;
  
 
procedure GetIPAddress;
var
  isIP,str:string;
  inifn1:TIniFile;
  i:integer;
  lst:TStrings;
begin
  try
    lst:=TStringList.create; 
    inifn1:=TIniFile.create(SkinFileName);
    str:=GetHttpStr('http://www.ip138.com/ip2city.asp'); 
    lst.text:=str; 
    if lst.count>0 then
      for i:=0 to lst.count-1 do
      if pos('您的IP地址是',lst.strings[i])>0 then  
        begin
	isIP:=StrBetween(lst.strings[i],'<center>','</center>');
	inifn1.WriteString('Item2','Item0',isIP);
	end;
  finally 
    inifn1.free; lst.free;
  end;
end;
 
procedure IPAddressSearch;
var 
  sVal,s,s1,s2,s3,s4:string;
  lst:TStrings;
  inifn:TIniFile; 
  i,j,k:integer;
begin
  try
    inifn:=TIniFile.create(SkinFileName);
    KeyWord:=inifn.ReadString('Item0','SMS1EditText','');
    lst:=TStringList.create; 
    sVal:=GetHttpStr('http://www.ip138.com/ips.asp?ip='+KeyWord); 
    if sVal<>'' then
    begin
    lst.text:=sVal; 
    //lst.SaveToFile('c:\11.txt'); 
    if lst.count>0 then
      for i:=0 to lst.count-1 do
        if pos('搜索IP地址的地理位置',lst.strings[i])>0 then  
          begin
          s :=StrBetween(lst.strings[i+3],'<h1>','</h1>'); 
	  inifn.WriteString('Item2','Item1',s);
	  s:=StrBetween(lst.strings[i+6],'"ul1"><li>','</li></ul></td>');  
	  s1:=sfReplace(s,'</li><li>','<#C_CR>',false);
	  inifn.WriteString('Item2','Item2',s1);
          end;
    end;
    RefreshSkin(True);
  finally
    lst.free; inifn.free;
  end;
end;

 
begin
  GetIPAddress;
  
end.