|
|
@ -320,7 +320,7 @@ function ip_is_country($ip, $country_id=['US'], $country=['美国'])
|
|
|
|
$res = file_get_contents($url);
|
|
|
|
$res = file_get_contents($url);
|
|
|
|
if (!$res) { // 走淘宝
|
|
|
|
if (!$res) { // 走淘宝
|
|
|
|
$res = file_get_contents($url2);
|
|
|
|
$res = file_get_contents($url2);
|
|
|
|
Log::write("taobal:".serialize($res));
|
|
|
|
Log::write("taobao:".serialize($res));
|
|
|
|
if (!empty($res)) {
|
|
|
|
if (!empty($res)) {
|
|
|
|
$ipData = json_decode($res,true);
|
|
|
|
$ipData = json_decode($res,true);
|
|
|
|
if ($ipData['code']==0 && in_array($ipData['data']['country_id'],$country_id)) {
|
|
|
|
if ($ipData['code']==0 && in_array($ipData['data']['country_id'],$country_id)) {
|
|
|
@ -333,9 +333,10 @@ function ip_is_country($ip, $country_id=['US'], $country=['美国'])
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$ipData = json_decode($res,true);
|
|
|
|
$res= iconv('GB2312', 'UTF-8', $res);
|
|
|
|
Log::write("taobal:".serialize($res));
|
|
|
|
$ipData = json_decode($res, true);
|
|
|
|
if ($ipData['status']==0 && substr($ipData['location'], 0, strlen($country[0])-1) == $country[0]) {
|
|
|
|
Log::write("sina:".serialize($res));
|
|
|
|
|
|
|
|
if ($ipData['status']==0 && substr($ipData['data'][0]['location'], 0, strlen($country[0])) == $country[0]) {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|