💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 获取客户端IP和所在地 > 直接获取当前客户端的IP,可指定IP获取地理信息 ## 请求地址 > [https://api.tjit.net/sip](https://api.tjit.net/sip) ## 请求方式 > GET ## 请求参数 | 参数名 | 值 | | --- | --- | | ip | ip地址(此参数为空时直接获取当前客户端的IP输出json数据) | | domain | 网址(无需加http://或https://) | >[danger] ## 以上参数只能任选其一,要么提供IP,要么提供网址,要么留空自动获取请求者IP ## 请求示例 PHP: ``` $str = file_get_contents("https://api.tjit.net/sip"); $arr = json_decode($str,true); echo $arr["local"]; ``` 易语言: ``` '首先加载精易模块:http://ec.125.la/ .版本 2 .支持库 spec .子程序 _启动子程序, 整数型, , 本子程序在程序启动后最先执行 .局部变量 str, 文本型 .局部变量 json, 类_json str = 网页_访问S (“https://api.tjit.net/sip”, , , , , “User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 Core/1.47.277.400 QQBrowser/9.4.7658.400”, , , , , , , , , , , , , , , ) json.解析 (str) 调试输出 (json.取通用属性 (“local”, )) ``` ## 返回参数 | 参数名 | 说明 | | --- | --- | | ip | 当前请求客户端的IP或者传入的IP地址 | | local | ip的地理位置 | ## 返回示例 ``` {"ip":"114.97.196.171","local":"\\u5b89\\u5fbd\\u7701\\u5408\\u80a5\\u5e02 \\u7535\\u4fe1"} ``` ## 接口调试 ~~~[api] get:https://api.tjit.net/sip ip#ip地址(为空时自动取请求客户端) <<< success <<< error ~~~ ~~~[api] get:https://api.tjit.net/sip string:domain=qq.com#网址 <<< success <<< error ~~~