curl -k -i -d "key=key&BusinessSecurityData=xxx&BusinessSecurityData.Account=xxx&BusinessSecurityData.Account.AccountType=xxx&BusinessSecurityData.Account.OtherAccount.AccountId=&BusinessSecurityData.Account.OtherAccount=&BusinessSecurityData.Account.QQAcount=&BusinessSecurityData.Account.WeChatAccount=&BusinessSecurityData.Account.QQAcount.QQOpenId=xxx&BusinessSecurityData.Account.QQAcount.AppIdUser=xxx&BusinessSecurityData.Account.QQAcount.AssociateAccount=&BusinessSecurityData.Account.QQAcount.MobilePhone=&BusinessSecurityData.Account.QQAcount.DeviceId=&BusinessSecurityData.Account.WeChatAccount.WeChatOpenId=xxx&BusinessSecurityData.Account.WeChatAccount.WeChatSubType=xxx&BusinessSecurityData.Account.WeChatAccount.RandStr=xxx&BusinessSecurityData.Account.WeChatAccount.WeChatAccessToken=xxx&BusinessSecurityData.Account.WeChatAccount.AssociateAccount=xxx&BusinessSecurityData.Account.WeChatAccount.MobilePhone=xxx&BusinessSecurityData.Account.WeChatAccount.DeviceId=xxx&BusinessSecurityData.UserId=&BusinessSecurityData.DeviceToken=&BusinessSecurityData.DeviceBusinessId=&BusinessSecurityData.BusinessId=&BusinessSecurityData.Nickname=&BusinessSecurityData.EmailAddress=&BusinessSecurityData.CheckDevice=&BusinessSecurityData.CookieHash=&BusinessSecurityData.Referer=&BusinessSecurityData.UserAgent=&BusinessSecurityData.XForwardedFor=&BusinessSecurityData.MacAddress=&BusinessSecurityData.VendorId=&BusinessSecurityData.DeviceType=&BusinessSecurityData.Sponsor=&BusinessSecurityData.Sponsor.SponsorOpenId=&BusinessSecurityData.Sponsor.SponsorDeviceNumber=&BusinessSecurityData.Sponsor.SponsorPhone=&BusinessSecurityData.Sponsor.SponsorIp=&BusinessSecurityData.Sponsor.CampaignUrl=&BusinessSecurityData.OnlineScam=&BusinessSecurityData.OnlineScam.ContentLabel=&BusinessSecurityData.OnlineScam.ContentRiskLevel=&BusinessSecurityData.OnlineScam.ContentType=&BusinessSecurityData.OnlineScam.FraudType=&BusinessSecurityData.OnlineScam.FraudAccount=" "http://apis.juhe.cn/antiRush/query?key="
<?php
/**
* 1578-查询 - 代码参考(根据实际业务情况修改)
*/
// 基本参数配置
$apiUrl = "http://apis.juhe.cn/antiRush/query?key="; // 接口请求URL
$method = "POST"; // 接口请求方式
$headers = ["Content-Type: application/x-www-form-urlencoded"]; // 接口请求header
$apiKey = "您申请的调用APIkey"; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
$requestParams = [
'key' => $apiKey,
'BusinessSecurityData'=> 'xxx',
'BusinessSecurityData.Account'=> 'xxx',
'BusinessSecurityData.Account.AccountType'=> 'xxx',
'BusinessSecurityData.Account.OtherAccount.AccountId'=> '',
'BusinessSecurityData.Account.OtherAccount'=> '',
'BusinessSecurityData.Account.QQAcount'=> '',
'BusinessSecurityData.Account.WeChatAccount'=> '',
'BusinessSecurityData.Account.QQAcount.QQOpenId'=> 'xxx',
'BusinessSecurityData.Account.QQAcount.AppIdUser'=> 'xxx',
'BusinessSecurityData.Account.QQAcount.AssociateAccount'=> '',
'BusinessSecurityData.Account.QQAcount.MobilePhone'=> '',
'BusinessSecurityData.Account.QQAcount.DeviceId'=> '',
'BusinessSecurityData.Account.WeChatAccount.WeChatOpenId'=> 'xxx',
'BusinessSecurityData.Account.WeChatAccount.WeChatSubType'=> 'xxx',
'BusinessSecurityData.Account.WeChatAccount.RandStr'=> 'xxx',
'BusinessSecurityData.Account.WeChatAccount.WeChatAccessToken'=> 'xxx',
'BusinessSecurityData.Account.WeChatAccount.AssociateAccount'=> 'xxx',
'BusinessSecurityData.Account.WeChatAccount.MobilePhone'=> 'xxx',
'BusinessSecurityData.Account.WeChatAccount.DeviceId'=> 'xxx',
'BusinessSecurityData.UserId'=> '',
'BusinessSecurityData.DeviceToken'=> '',
'BusinessSecurityData.DeviceBusinessId'=> '',
'BusinessSecurityData.BusinessId'=> '',
'BusinessSecurityData.Nickname'=> '',
'BusinessSecurityData.EmailAddress'=> '',
'BusinessSecurityData.CheckDevice'=> '',
'BusinessSecurityData.CookieHash'=> '',
'BusinessSecurityData.Referer'=> '',
'BusinessSecurityData.UserAgent'=> '',
'BusinessSecurityData.XForwardedFor'=> '',
'BusinessSecurityData.MacAddress'=> '',
'BusinessSecurityData.VendorId'=> '',
'BusinessSecurityData.DeviceType'=> '',
'BusinessSecurityData.Sponsor'=> '',
'BusinessSecurityData.Sponsor.SponsorOpenId'=> '',
'BusinessSecurityData.Sponsor.SponsorDeviceNumber'=> '',
'BusinessSecurityData.Sponsor.SponsorPhone'=> '',
'BusinessSecurityData.Sponsor.SponsorIp'=> '',
'BusinessSecurityData.Sponsor.CampaignUrl'=> '',
'BusinessSecurityData.OnlineScam'=> '',
'BusinessSecurityData.OnlineScam.ContentLabel'=> '',
'BusinessSecurityData.OnlineScam.ContentRiskLevel'=> '',
'BusinessSecurityData.OnlineScam.ContentType'=> '',
'BusinessSecurityData.OnlineScam.FraudType'=> '',
'BusinessSecurityData.OnlineScam.FraudAccount'=> '',
];
$requestParamsStr = http_build_query($requestParams);
// 发起接口网络请求
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
if (1 == strpos("$" . $apiUrl, "https://")) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestParamsStr);
$response = curl_exec($curl);
$httpInfo = curl_getinfo($curl);
curl_close($curl);
// 解析响应结果
$responseResult = json_decode($response, true);
if ($responseResult) {
// 网络请求成功。可依据业务逻辑和接口文档说明自行处理。
var_dump($responseResult);
} else {
// 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。
// var_dump($httpInfo);
var_dump("请求异常");
}
import requests
# 1578-查询 - 代码参考(根据实际业务情况修改)
# 基本参数配置
apiUrl = 'http://apis.juhe.cn/antiRush/query?key=' # 接口请求URL
apiKey = '您申请的调用APIkey' # 在个人中心->我的数据,接口名称上方查看
# 接口请求入参配置
requestParams = {
'key': apiKey,
'BusinessSecurityData': 'xxx',
'BusinessSecurityData.Account': 'xxx',
'BusinessSecurityData.Account.AccountType': 'xxx',
'BusinessSecurityData.Account.OtherAccount.AccountId': '',
'BusinessSecurityData.Account.OtherAccount': '',
'BusinessSecurityData.Account.QQAcount': '',
'BusinessSecurityData.Account.WeChatAccount': '',
'BusinessSecurityData.Account.QQAcount.QQOpenId': 'xxx',
'BusinessSecurityData.Account.QQAcount.AppIdUser': 'xxx',
'BusinessSecurityData.Account.QQAcount.AssociateAccount': '',
'BusinessSecurityData.Account.QQAcount.MobilePhone': '',
'BusinessSecurityData.Account.QQAcount.DeviceId': '',
'BusinessSecurityData.Account.WeChatAccount.WeChatOpenId': 'xxx',
'BusinessSecurityData.Account.WeChatAccount.WeChatSubType': 'xxx',
'BusinessSecurityData.Account.WeChatAccount.RandStr': 'xxx',
'BusinessSecurityData.Account.WeChatAccount.WeChatAccessToken': 'xxx',
'BusinessSecurityData.Account.WeChatAccount.AssociateAccount': 'xxx',
'BusinessSecurityData.Account.WeChatAccount.MobilePhone': 'xxx',
'BusinessSecurityData.Account.WeChatAccount.DeviceId': 'xxx',
'BusinessSecurityData.UserId': '',
'BusinessSecurityData.DeviceToken': '',
'BusinessSecurityData.DeviceBusinessId': '',
'BusinessSecurityData.BusinessId': '',
'BusinessSecurityData.Nickname': '',
'BusinessSecurityData.EmailAddress': '',
'BusinessSecurityData.CheckDevice': '',
'BusinessSecurityData.CookieHash': '',
'BusinessSecurityData.Referer': '',
'BusinessSecurityData.UserAgent': '',
'BusinessSecurityData.XForwardedFor': '',
'BusinessSecurityData.MacAddress': '',
'BusinessSecurityData.VendorId': '',
'BusinessSecurityData.DeviceType': '',
'BusinessSecurityData.Sponsor': '',
'BusinessSecurityData.Sponsor.SponsorOpenId': '',
'BusinessSecurityData.Sponsor.SponsorDeviceNumber': '',
'BusinessSecurityData.Sponsor.SponsorPhone': '',
'BusinessSecurityData.Sponsor.SponsorIp': '',
'BusinessSecurityData.Sponsor.CampaignUrl': '',
'BusinessSecurityData.OnlineScam': '',
'BusinessSecurityData.OnlineScam.ContentLabel': '',
'BusinessSecurityData.OnlineScam.ContentRiskLevel': '',
'BusinessSecurityData.OnlineScam.ContentType': '',
'BusinessSecurityData.OnlineScam.FraudType': '',
'BusinessSecurityData.OnlineScam.FraudAccount': '',
}
# 发起接口网络请求
response = requests.post(apiUrl, requestParams)
# 解析响应结果
if response.status_code == 200:
responseResult = response.json()
# 网络请求成功。可依据业务逻辑和接口文档说明自行处理。
print(responseResult)
else:
# 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。
print('请求异常')
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"strings"
)
func main() {
// 基本参数配置
apiUrl := "http://apis.juhe.cn/antiRush/query?key="
apiKey := "您申请的调用APIkey"
// 接口请求入参配置
requestParams := url.Values{}
requestParams.Set("key", apiKey)
requestParams.Set("BusinessSecurityData", "xxx")
requestParams.Set("BusinessSecurityData.Account", "xxx")
requestParams.Set("BusinessSecurityData.Account.AccountType", "xxx")
requestParams.Set("BusinessSecurityData.Account.OtherAccount.AccountId", "")
requestParams.Set("BusinessSecurityData.Account.OtherAccount", "")
requestParams.Set("BusinessSecurityData.Account.QQAcount", "")
requestParams.Set("BusinessSecurityData.Account.WeChatAccount", "")
requestParams.Set("BusinessSecurityData.Account.QQAcount.QQOpenId", "xxx")
requestParams.Set("BusinessSecurityData.Account.QQAcount.AppIdUser", "xxx")
requestParams.Set("BusinessSecurityData.Account.QQAcount.AssociateAccount", "")
requestParams.Set("BusinessSecurityData.Account.QQAcount.MobilePhone", "")
requestParams.Set("BusinessSecurityData.Account.QQAcount.DeviceId", "")
requestParams.Set("BusinessSecurityData.Account.WeChatAccount.WeChatOpenId", "xxx")
requestParams.Set("BusinessSecurityData.Account.WeChatAccount.WeChatSubType", "xxx")
requestParams.Set("BusinessSecurityData.Account.WeChatAccount.RandStr", "xxx")
requestParams.Set("BusinessSecurityData.Account.WeChatAccount.WeChatAccessToken", "xxx")
requestParams.Set("BusinessSecurityData.Account.WeChatAccount.AssociateAccount", "xxx")
requestParams.Set("BusinessSecurityData.Account.WeChatAccount.MobilePhone", "xxx")
requestParams.Set("BusinessSecurityData.Account.WeChatAccount.DeviceId", "xxx")
requestParams.Set("BusinessSecurityData.UserId", "")
requestParams.Set("BusinessSecurityData.DeviceToken", "")
requestParams.Set("BusinessSecurityData.DeviceBusinessId", "")
requestParams.Set("BusinessSecurityData.BusinessId", "")
requestParams.Set("BusinessSecurityData.Nickname", "")
requestParams.Set("BusinessSecurityData.EmailAddress", "")
requestParams.Set("BusinessSecurityData.CheckDevice", "")
requestParams.Set("BusinessSecurityData.CookieHash", "")
requestParams.Set("BusinessSecurityData.Referer", "")
requestParams.Set("BusinessSecurityData.UserAgent", "")
requestParams.Set("BusinessSecurityData.XForwardedFor", "")
requestParams.Set("BusinessSecurityData.MacAddress", "")
requestParams.Set("BusinessSecurityData.VendorId", "")
requestParams.Set("BusinessSecurityData.DeviceType", "")
requestParams.Set("BusinessSecurityData.Sponsor", "")
requestParams.Set("BusinessSecurityData.Sponsor.SponsorOpenId", "")
requestParams.Set("BusinessSecurityData.Sponsor.SponsorDeviceNumber", "")
requestParams.Set("BusinessSecurityData.Sponsor.SponsorPhone", "")
requestParams.Set("BusinessSecurityData.Sponsor.SponsorIp", "")
requestParams.Set("BusinessSecurityData.Sponsor.CampaignUrl", "")
requestParams.Set("BusinessSecurityData.OnlineScam", "")
requestParams.Set("BusinessSecurityData.OnlineScam.ContentLabel", "")
requestParams.Set("BusinessSecurityData.OnlineScam.ContentRiskLevel", "")
requestParams.Set("BusinessSecurityData.OnlineScam.ContentType", "")
requestParams.Set("BusinessSecurityData.OnlineScam.FraudType", "")
requestParams.Set("BusinessSecurityData.OnlineScam.FraudAccount", "")
// 发起接口网络请求
resp, err := http.Post(apiUrl, "application/x-www-form-urlencoded", strings.NewReader(requestParams.Encode()))
if err != nil {
fmt.Println("网络请求异常:", err)
return
}
defer resp.Body.Close()
var responseResult map[string]interface{}
err = json.NewDecoder(resp.Body).Decode(&responseResult)
if err != nil {
fmt.Println("解析响应结果异常:", err)
return
}
fmt.Println(responseResult)
}
using System;
using System.Text;
using System.Net;
using Newtonsoft.Json;
using System.Collections.Specialized;
namespace Common_API_Test.Test_Demo
{
class Csharp_post
{
static void Main(string[] args)
{
string url = "http://apis.juhe.cn/antiRush/query?key=";
string apiKey = "您申请的调用APIkey";
using (WebClient client = new WebClient())
{
var data = new NameValueCollection();
// 添加元素到 NameValueCollection
data.Add("key", apiKey);
data.Add( "BusinessSecurityData", "xxx");
data.Add( "BusinessSecurityData.Account", "xxx");
data.Add( "BusinessSecurityData.Account.AccountType", "xxx");
data.Add( "BusinessSecurityData.Account.OtherAccount.AccountId", "");
data.Add( "BusinessSecurityData.Account.OtherAccount", "");
data.Add( "BusinessSecurityData.Account.QQAcount", "");
data.Add( "BusinessSecurityData.Account.WeChatAccount", "");
data.Add( "BusinessSecurityData.Account.QQAcount.QQOpenId", "xxx");
data.Add( "BusinessSecurityData.Account.QQAcount.AppIdUser", "xxx");
data.Add( "BusinessSecurityData.Account.QQAcount.AssociateAccount", "");
data.Add( "BusinessSecurityData.Account.QQAcount.MobilePhone", "");
data.Add( "BusinessSecurityData.Account.QQAcount.DeviceId", "");
data.Add( "BusinessSecurityData.Account.WeChatAccount.WeChatOpenId", "xxx");
data.Add( "BusinessSecurityData.Account.WeChatAccount.WeChatSubType", "xxx");
data.Add( "BusinessSecurityData.Account.WeChatAccount.RandStr", "xxx");
data.Add( "BusinessSecurityData.Account.WeChatAccount.WeChatAccessToken", "xxx");
data.Add( "BusinessSecurityData.Account.WeChatAccount.AssociateAccount", "xxx");
data.Add( "BusinessSecurityData.Account.WeChatAccount.MobilePhone", "xxx");
data.Add( "BusinessSecurityData.Account.WeChatAccount.DeviceId", "xxx");
data.Add( "BusinessSecurityData.UserId", "");
data.Add( "BusinessSecurityData.DeviceToken", "");
data.Add( "BusinessSecurityData.DeviceBusinessId", "");
data.Add( "BusinessSecurityData.BusinessId", "");
data.Add( "BusinessSecurityData.Nickname", "");
data.Add( "BusinessSecurityData.EmailAddress", "");
data.Add( "BusinessSecurityData.CheckDevice", "");
data.Add( "BusinessSecurityData.CookieHash", "");
data.Add( "BusinessSecurityData.Referer", "");
data.Add( "BusinessSecurityData.UserAgent", "");
data.Add( "BusinessSecurityData.XForwardedFor", "");
data.Add( "BusinessSecurityData.MacAddress", "");
data.Add( "BusinessSecurityData.VendorId", "");
data.Add( "BusinessSecurityData.DeviceType", "");
data.Add( "BusinessSecurityData.Sponsor", "");
data.Add( "BusinessSecurityData.Sponsor.SponsorOpenId", "");
data.Add( "BusinessSecurityData.Sponsor.SponsorDeviceNumber", "");
data.Add( "BusinessSecurityData.Sponsor.SponsorPhone", "");
data.Add( "BusinessSecurityData.Sponsor.SponsorIp", "");
data.Add( "BusinessSecurityData.Sponsor.CampaignUrl", "");
data.Add( "BusinessSecurityData.OnlineScam", "");
data.Add( "BusinessSecurityData.OnlineScam.ContentLabel", "");
data.Add( "BusinessSecurityData.OnlineScam.ContentRiskLevel", "");
data.Add( "BusinessSecurityData.OnlineScam.ContentType", "");
data.Add( "BusinessSecurityData.OnlineScam.FraudType", "");
data.Add( "BusinessSecurityData.OnlineScam.FraudAccount", "");
try
{
byte[] response = client.UploadValues(url, "POST", data);
string responseContent = Encoding.UTF8.GetString(response);
dynamic responseData = JsonConvert.DeserializeObject(responseContent);
if (responseData != null)
{
Console.WriteLine("Return Code: " + responseData["error_code"]);
Console.WriteLine("Return Message: " + responseData["reason"]);
}
else
{
Console.WriteLine("json解析异常!");
}
}
catch (Exception)
{
Console.WriteLine("请检查其它错误");
}
}
}
}
}
const axios = require('axios'); // npm install axios
// 基本参数配置
const apiUrl = 'http://apis.juhe.cn/antiRush/query?key='; // 接口请求URL
const apiKey = '您申请的调用APIkey'; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
const requestParams = {
key: apiKey,
BusinessSecurityData: 'xxx',
BusinessSecurityData.Account: 'xxx',
BusinessSecurityData.Account.AccountType: 'xxx',
BusinessSecurityData.Account.OtherAccount.AccountId: '',
BusinessSecurityData.Account.OtherAccount: '',
BusinessSecurityData.Account.QQAcount: '',
BusinessSecurityData.Account.WeChatAccount: '',
BusinessSecurityData.Account.QQAcount.QQOpenId: 'xxx',
BusinessSecurityData.Account.QQAcount.AppIdUser: 'xxx',
BusinessSecurityData.Account.QQAcount.AssociateAccount: '',
BusinessSecurityData.Account.QQAcount.MobilePhone: '',
BusinessSecurityData.Account.QQAcount.DeviceId: '',
BusinessSecurityData.Account.WeChatAccount.WeChatOpenId: 'xxx',
BusinessSecurityData.Account.WeChatAccount.WeChatSubType: 'xxx',
BusinessSecurityData.Account.WeChatAccount.RandStr: 'xxx',
BusinessSecurityData.Account.WeChatAccount.WeChatAccessToken: 'xxx',
BusinessSecurityData.Account.WeChatAccount.AssociateAccount: 'xxx',
BusinessSecurityData.Account.WeChatAccount.MobilePhone: 'xxx',
BusinessSecurityData.Account.WeChatAccount.DeviceId: 'xxx',
BusinessSecurityData.UserId: '',
BusinessSecurityData.DeviceToken: '',
BusinessSecurityData.DeviceBusinessId: '',
BusinessSecurityData.BusinessId: '',
BusinessSecurityData.Nickname: '',
BusinessSecurityData.EmailAddress: '',
BusinessSecurityData.CheckDevice: '',
BusinessSecurityData.CookieHash: '',
BusinessSecurityData.Referer: '',
BusinessSecurityData.UserAgent: '',
BusinessSecurityData.XForwardedFor: '',
BusinessSecurityData.MacAddress: '',
BusinessSecurityData.VendorId: '',
BusinessSecurityData.DeviceType: '',
BusinessSecurityData.Sponsor: '',
BusinessSecurityData.Sponsor.SponsorOpenId: '',
BusinessSecurityData.Sponsor.SponsorDeviceNumber: '',
BusinessSecurityData.Sponsor.SponsorPhone: '',
BusinessSecurityData.Sponsor.SponsorIp: '',
BusinessSecurityData.Sponsor.CampaignUrl: '',
BusinessSecurityData.OnlineScam: '',
BusinessSecurityData.OnlineScam.ContentLabel: '',
BusinessSecurityData.OnlineScam.ContentRiskLevel: '',
BusinessSecurityData.OnlineScam.ContentType: '',
BusinessSecurityData.OnlineScam.FraudType: '',
BusinessSecurityData.OnlineScam.FraudAccount: '',
};
// 发起接口网络请求
axios.post(apiUrl, requestParams, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
.then(response => {
// 解析响应结果
if (response.status === 200) {
const responseResult = response.data;
// 网络请求成功。可依据业务逻辑和接口文档说明自行处理。
console.log(responseResult);
} else {
// 网络异常等因素,解析结果异常。可依据业务逻辑自行处理。
console.log('请求异常');
}
})
.catch(error => {
// 网络请求失败,可以根据实际情况进行处理
console.log('网络请求失败:', error);
});
package cn.juhe.test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
public class JavaPost {
public static void main(String[] args) throws Exception {
String apiKey = "你申请的key";
String apiUrl = "http://apis.juhe.cn/antiRush/query?key=";
HashMap<String, String> map = new HashMap<>();
map.put("key", apiKey);
map.put("BusinessSecurityData", "xxx");
map.put("BusinessSecurityData.Account", "xxx");
map.put("BusinessSecurityData.Account.AccountType", "xxx");
map.put("BusinessSecurityData.Account.OtherAccount.AccountId", "");
map.put("BusinessSecurityData.Account.OtherAccount", "");
map.put("BusinessSecurityData.Account.QQAcount", "");
map.put("BusinessSecurityData.Account.WeChatAccount", "");
map.put("BusinessSecurityData.Account.QQAcount.QQOpenId", "xxx");
map.put("BusinessSecurityData.Account.QQAcount.AppIdUser", "xxx");
map.put("BusinessSecurityData.Account.QQAcount.AssociateAccount", "");
map.put("BusinessSecurityData.Account.QQAcount.MobilePhone", "");
map.put("BusinessSecurityData.Account.QQAcount.DeviceId", "");
map.put("BusinessSecurityData.Account.WeChatAccount.WeChatOpenId", "xxx");
map.put("BusinessSecurityData.Account.WeChatAccount.WeChatSubType", "xxx");
map.put("BusinessSecurityData.Account.WeChatAccount.RandStr", "xxx");
map.put("BusinessSecurityData.Account.WeChatAccount.WeChatAccessToken", "xxx");
map.put("BusinessSecurityData.Account.WeChatAccount.AssociateAccount", "xxx");
map.put("BusinessSecurityData.Account.WeChatAccount.MobilePhone", "xxx");
map.put("BusinessSecurityData.Account.WeChatAccount.DeviceId", "xxx");
map.put("BusinessSecurityData.UserId", "");
map.put("BusinessSecurityData.DeviceToken", "");
map.put("BusinessSecurityData.DeviceBusinessId", "");
map.put("BusinessSecurityData.BusinessId", "");
map.put("BusinessSecurityData.Nickname", "");
map.put("BusinessSecurityData.EmailAddress", "");
map.put("BusinessSecurityData.CheckDevice", "");
map.put("BusinessSecurityData.CookieHash", "");
map.put("BusinessSecurityData.Referer", "");
map.put("BusinessSecurityData.UserAgent", "");
map.put("BusinessSecurityData.XForwardedFor", "");
map.put("BusinessSecurityData.MacAddress", "");
map.put("BusinessSecurityData.VendorId", "");
map.put("BusinessSecurityData.DeviceType", "");
map.put("BusinessSecurityData.Sponsor", "");
map.put("BusinessSecurityData.Sponsor.SponsorOpenId", "");
map.put("BusinessSecurityData.Sponsor.SponsorDeviceNumber", "");
map.put("BusinessSecurityData.Sponsor.SponsorPhone", "");
map.put("BusinessSecurityData.Sponsor.SponsorIp", "");
map.put("BusinessSecurityData.Sponsor.CampaignUrl", "");
map.put("BusinessSecurityData.OnlineScam", "");
map.put("BusinessSecurityData.OnlineScam.ContentLabel", "");
map.put("BusinessSecurityData.OnlineScam.ContentRiskLevel", "");
map.put("BusinessSecurityData.OnlineScam.ContentType", "");
map.put("BusinessSecurityData.OnlineScam.FraudType", "");
map.put("BusinessSecurityData.OnlineScam.FraudAccount", "");
URL url = new URL(apiUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setDoOutput(true);
String urlParameters = params(map);
try (OutputStream os = connection.getOutputStream()) {
byte[] input = urlParameters.getBytes(StandardCharsets.UTF_8);
os.write(input, 0, input.length);
}
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
// 打印响应
System.out.println(response);
}
public static String params(Map<String, String> map) {
return map.entrySet().stream()
.map(entry -> {
try {
return entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString());
} catch (Exception e) {
e.printStackTrace();
return entry.getKey() + "=" + entry.getValue();
}
})
.collect(Collectors.joining("&"));
}
}
// 基本参数配置
NSString *apiUrl = @"http://apis.juhe.cn/antiRush/query?key="; // 接口请求URL
NSString *apiKey = @"您申请的调用APIkey"; // 在个人中心->我的数据,接口名称上方查看
// 接口请求入参配置
NSDictionary *requestParams = @{
@"key": apiKey,
@"BusinessSecurityData": @"xxx",
@"BusinessSecurityData.Account": @"xxx",
@"BusinessSecurityData.Account.AccountType": @"xxx",
@"BusinessSecurityData.Account.OtherAccount.AccountId": @"",
@"BusinessSecurityData.Account.OtherAccount": @"",
@"BusinessSecurityData.Account.QQAcount": @"",
@"BusinessSecurityData.Account.WeChatAccount": @"",
@"BusinessSecurityData.Account.QQAcount.QQOpenId": @"xxx",
@"BusinessSecurityData.Account.QQAcount.AppIdUser": @"xxx",
@"BusinessSecurityData.Account.QQAcount.AssociateAccount": @"",
@"BusinessSecurityData.Account.QQAcount.MobilePhone": @"",
@"BusinessSecurityData.Account.QQAcount.DeviceId": @"",
@"BusinessSecurityData.Account.WeChatAccount.WeChatOpenId": @"xxx",
@"BusinessSecurityData.Account.WeChatAccount.WeChatSubType": @"xxx",
@"BusinessSecurityData.Account.WeChatAccount.RandStr": @"xxx",
@"BusinessSecurityData.Account.WeChatAccount.WeChatAccessToken": @"xxx",
@"BusinessSecurityData.Account.WeChatAccount.AssociateAccount": @"xxx",
@"BusinessSecurityData.Account.WeChatAccount.MobilePhone": @"xxx",
@"BusinessSecurityData.Account.WeChatAccount.DeviceId": @"xxx",
@"BusinessSecurityData.UserId": @"",
@"BusinessSecurityData.DeviceToken": @"",
@"BusinessSecurityData.DeviceBusinessId": @"",
@"BusinessSecurityData.BusinessId": @"",
@"BusinessSecurityData.Nickname": @"",
@"BusinessSecurityData.EmailAddress": @"",
@"BusinessSecurityData.CheckDevice": @"",
@"BusinessSecurityData.CookieHash": @"",
@"BusinessSecurityData.Referer": @"",
@"BusinessSecurityData.UserAgent": @"",
@"BusinessSecurityData.XForwardedFor": @"",
@"BusinessSecurityData.MacAddress": @"",
@"BusinessSecurityData.VendorId": @"",
@"BusinessSecurityData.DeviceType": @"",
@"BusinessSecurityData.Sponsor": @"",
@"BusinessSecurityData.Sponsor.SponsorOpenId": @"",
@"BusinessSecurityData.Sponsor.SponsorDeviceNumber": @"",
@"BusinessSecurityData.Sponsor.SponsorPhone": @"",
@"BusinessSecurityData.Sponsor.SponsorIp": @"",
@"BusinessSecurityData.Sponsor.CampaignUrl": @"",
@"BusinessSecurityData.OnlineScam": @"",
@"BusinessSecurityData.OnlineScam.ContentLabel": @"",
@"BusinessSecurityData.OnlineScam.ContentRiskLevel": @"",
@"BusinessSecurityData.OnlineScam.ContentType": @"",
@"BusinessSecurityData.OnlineScam.FraudType": @"",
@"BusinessSecurityData.OnlineScam.FraudAccount": @"",
};
// 将请求参数转换成字符串形式
NSMutableString *postString = [NSMutableString string];
[requestParams enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *value, BOOL *stop) {
[postString appendFormat:@"%@=%@&", key, value];
}];
[postString deleteCharactersInRange:NSMakeRange(postString.length - 1, 1)]; // 删除最后一个"&"
// 发起接口网络请求
NSURL *url = [NSURL URLWithString:apiUrl];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod = @"POST";
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
request.HTTPBody = [postString dataUsingEncoding:NSUTF8StringEncoding]; // 设置HTTPBody为转换后的参数字符串
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
// 网络请求异常处理
NSLog(@"请求异常");
} else {
NSError *jsonError;
NSDictionary *responseResult = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
if (!jsonError) {
// 网络请求成功处理
NSLog(@"%@", [responseResult objectForKey:@"error_code"]);
NSLog(@"%@", [responseResult objectForKey:@"reason"]);
NSLog(@"%@", responseResult);
} else {
// 解析结果异常处理
NSLog(@"解析结果异常");
}
}
}];
[task resume];