如何解决在 Inno Setup 中使用第 3 方 API 的代理和虚拟机过滤器
我正在尝试使用 3rd 方 API 来过滤代理流量和虚拟机以及每个不同的文件,我使用了以下代码(https://pastebin.com/hWZX1Sxq)JasonParser 文件(https://pastebin.com/hNspZxVY)但是函数不工作,编译时也没有错误信息。
function ProxyDetected(ip:string):Boolean;
var
WinHttpReq: Variant;
jsonText : String;
JsonParser: TJsonParser;
jBool : TJsonWord;
I:integer;
begin
try
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('GET','https://api.ipregistry.co/'+ip+'?key=roygrcxz372rjb&fields=security&pretty=true',False);
WinHttpReq.Send;
jsonText := Trim(WinHttpReq.ResponseText);
Log(jsonText);
ParseJson(JsonParser,jsonText);
if GetArrayLength(JsonParser.Output.Errors) > 0 then
begin
Log('Error parsing JSON');
for I := 0 to GetArrayLength(JsonParser.Output.Errors) - 1 do
begin
Log(JsonParser.Output.Errors[I]);
end;
end
else
begin
//if FindJsonWord(JsonParser.Output,GetJsonRoot(JsonParser.Output),'proxy',jBool) then
if FindJsonWord(JsonParser.Output,'is_cloud_provider',jBool) then
begin
if jBool = JWTrue then
//Log('proxy:true')
Log('is_cloud_provider:true')
else
//Log('proxy:false');
Log('is_cloud_provider:false')
end;
end;
ClearjsonParser(JsonParser);
Result := (Trim(WinHttpReq.ResponseText) = '1');
except
Log(GetExceptionMessage);
Result := false;
end;
end;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。