Initial commit

This commit is contained in:
net909
2023-09-28 16:21:06 +08:00
parent 498772eb04
commit ba7be004c0
640 changed files with 87745 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace plugin\web\ip\api;
use Exception;
use plugin\web\ip\api;
/**
* {"ip":"218.89.171.143","pro":"四川省","proCode":"510000","city":"成都市","cityCode":"510100","region":"","regionCode":"0","addr":"四川省成都市 电信","regionNames":"","err":""}
*/
class pconline implements api
{
public function query($ip){
$url = 'http://whois.pconline.com.cn/ipJson.jsp?json=true&ip='.$ip;
$data = get_curl($url);
$data = mb_convert_encoding($data, "UTF-8", "GB2312");
$arr = json_decode($data, true);
if (isset($arr['addr'])) {
return ['IP所在地'=>$arr['addr']];
}else{
throw new Exception('接口查询失败,返回结果错误');
}
}
}