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

最后都变了- 提交于 2019-11-30 07:38:40

加我微信:Leedege一起交流Delphi开发经验

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;

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!