Delphi XE7 用indy开发微信公众平台(2)- 获取微信服务器IP地址

时间:2015-02-09 22:51:19   收藏:0   阅读:799

获取微信服务器IP地址

const

ServerIpUrl = https://api.weixin.qq.com/cgi-bin/getcallbackip?&access_token=%s;

procedure GetServerList(out List: TStringList; AccessToken: String);
var
  Url: string;
  J: TJSONObject;
  temp: String;
begin
  Url := Format(ServerIpUrl, [Access_Token]);
  J := TJSONObject.ParseJSONValue(GetMethod(Url, 1)) as TJSONObject;
  try
    if J.Count > 0 then
    begin
      temp := J.GetValue(ip_list).ToString;
      delete(temp, 1, 1);
      delete(temp, Length(temp), 1);
      List.DelimitedText := temp;
    end;
  finally
    J.Free;
  end;
end;

 

原文地址:http://www.cnblogs.com/devinlee/p/4282521.html

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!