• 根据ip获取地理信息.php



    根据ip获取地理信息.php

    
    <?php
    
    function getIPLoc_sina($queryIP){    
    $url = 'http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json&ip='.$queryIP;    
    $ch = curl_init($url);     
    curl_setopt($ch,CURLOPT_ENCODING ,'utf8');     
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);   
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ; // 获取数据返回  
    $location = curl_exec($ch);    
    $location = json_decode($location);    
    curl_close($ch);         
    $loc = "";   
    if($location===FALSE) return "";     
    if (empty($location->desc)) {    
    $loc = $location->province.$location->city.$location->district.$location->isp;  
    }else{         $loc = $location->desc;    
    }    
    return $loc;
    }
    echo getIPLoc_sina("183.37.209.57");
    
    
  • 相关阅读:
    前端布局定位
    CSS优化
    CSS工程化
    CSS过渡,动画,2D,3D转换
    CSS,盒子和美化技巧
    HTMl
    定位和布局
    CSS选择器
    八. 实时更新插件 livereload
    七. 浏览器插件 View in Browser
  • 原文地址:https://www.cnblogs.com/datiangou/p/10199958.html
Copyright © 2020-2023  润新知