支持:谷歌、百度、搜狗、必应、yandex、360搜索。
. H- V6 [1 ^0 V
- <?php
- error_reporting(0);
- header('content-type:application/json;charset=utf8');
-
- if($_GET['ip'])
- {
- $domain = htmlentities($_GET["ip"], ENT_QUOTES | ENT_IGNORE, "UTF-8");
-
- $rbl = 'in-addr.arpa';
- $rev = array_reverse(explode('.', $domain));
- $lookup = implode('.', $rev) . '.' . $rbl;
- function so360($ip){
- $iparr=explode('.', $ip);
- $so360=false;
- if((strpos($ip,'180.153') !== false) or (strpos($ip,'180.163') !== false)){
- if('220'<=$iparr['2'] and $iparr['2']<='236'){
- $so360=true;
- }
-
- }else if((strpos($ip,'42.236') !== false)){
- if((10<=$iparr['2'] and $iparr['2']<=99) or (101<=$iparr['2'] and $iparr['2']<=103)){
- $so360=true;
- }
- }
- return $so360;
-
- }
- $dns=dns_get_record($lookup);
- //print_R($dns);
- $spider=true;
- if(strpos($dns['0']['target'],'baidu') !== false){
- $gs='百度蜘蛛';
- }elseif(strpos($dns['0']['target'],'googlebot') !== false){
- $gs='谷歌蜘蛛';
- }elseif(strpos($dns['0']['target'],'msnbot') !== false){
- $gs='必应蜘蛛';
- }elseif(strpos($dns['0']['target'],'sogou') !== false){
- $gs='搜狗蜘蛛';
- }elseif(strpos($dns['0']['target'],'yandex') !== false){
- $gs='yandex蜘蛛';
- }elseif(so360($domain)){
- $gs='360蜘蛛';
- }elseif(!filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
- $gs='输入的ip不合法';
- $spider=false;
- }else{
- $gs='虚假蜘蛛';
- $spider=false;
- }
完整版下载:
) D! T3 W. Q1 Z2 [ v " Y% g1 p3 q6 B& t2 n
9 I- o: {7 O7 C; W; N; Y
|