{ "code": 200, "ip": "122.96.45.59", "region": "江苏省-南京市", "isp": null, "os": "Windows 10 x64", "ua": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/73.0.3683.103 Safari\/537.36", "bro": "Chrome(73.0.3683.103)", "time": "2020年05月01日 17时34分26秒" }
<?php /** * Created by PhpStorm. * User: FZS * Time: 2020/05/01 13:26 */ class freeApi { private $apiUrl; public function __construct() { $this->apiUrl = 'https://api.66mz8.com/api/ip.info.php'; } /** * 获取结果 * @return array */ public function getResult() { return file_get_contents($this->apiUrl); } }
package main import ( "fmt" "io/ioutil" "log" "net/http" ) const ( APIURL = "https://api.66mz8.com/api/ip.info.php" ) func main() { queryUrl := fmt.Sprintf("%s",APIURL) resp, err := http.Get(queryUrl) if err != nil { log.Println(err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) }