您好我正在使用maxmind minfraud。我得到了这样的结果:
ERR =; COUNTRYCODE = IN; ip_region = 25; ip_city =; ip_latitude = 10.0223; ip_longitude = 30.2433; highRiskCountry =无; queriesRemaining = 1075; cityPostalMatch =; shipCityPostalMatch =; ip_domain =; ip_countryName =; ip_continentCode = AS; ip_corporateProxy =无; shipForward = NA; riskScore = 0.20;预付=; minfraud_version = 1.3
这里我想以数组值的形式返回。
<?php
function fraudQuery($ip, $country_code, $state, $city, $area_code, $mail_domain,$address)
{
$d = file_get_contents("https://minfraud.maxmind.com/app/ccv2r?license_key=".IP_LOOKUP_KEY."&i=$ip&country=$country_code&city=$city&postal=$area_code&domain=$mail_domain&shipAddr=$address&shipCity=$city&shipRegion=$state&shipPostal=$area_code&shipCountry=$country_code");
return array('Errors' =>err, 'IpCountryCode' => countryCode, 'IpCountry' => ip_countryName, 'IpRegionCode' => ip_region, 'IpRegion' => ip_regionName, 'IpCity' => ip_city, 'IpHostName' => ip_domain, 'Score' => riskScore);
}
?>
如何像这样返回数组值。感谢
答案 0 :(得分:5)
parse_str(str_replace(';','&',$yourresultfromURL),$matcharray);
将;
替换为&
,以便将其转换为parse_str
格式,最后将这些匹配移至$matcharray
数组。