【做骚扰电话拦截,如果需要做联网识别可以用我这个接口】
http://1.harassphone.applinzi.com/phone.php?phone=15677246297
【json返回数据示例:type为空则不是骚扰电话】
{"phone":"15677246297","where":"广西柳州","cmcc":"联通","type":"响一声电话!请谨慎回拨!"}
{"phone":"4000024005","where":"","cmcc":"","type":"骚扰电话"}
{"phone":"17092908843","where":"陕西西安","cmcc":"蜗牛移动","type":"骚扰电话"}
【需要注意的是:服务器流量要钱的,不要恶意刷并发,没钱续费】
【json返回数据示例:type为空则不是骚扰电话】
{"phone":"15677246297","where":"广西柳州","cmcc":"联通","type":"响一声电话!请谨慎回拨!"}
{"phone":"4000024005","where":"","cmcc":"","type":"骚扰电话"}
{"phone":"17092908843","where":"陕西西安","cmcc":"蜗牛移动","type":"骚扰电话"}
【需要注意的是:服务器流量要钱的,不要恶意刷并发,没钱续费】
我也不知道我几时会把这个接口停掉,所以给出php源码,需要的可以部署在自己的服务器上使用
<?php
class Result{
var $phone;
var $where;
var $cmcc;
var $type;
}
function get($url = '') {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
function get_tag( $attr, $value, $xml, $tag=null ) {
if( is_null($tag) )
$tag = '\w+';
else
$tag = preg_quote($tag);
$attr = preg_quote($attr);
$value = preg_quote($value);
$tag_regex = "/<(".$tag.")[^>]*$attr\s*=\s*".
"(['\"])$value\\2[^>]*>(.*?)<\/\\1>/";
preg_match_all($tag_regex,
$xml,
$matches,
PREG_PATTERN_ORDER);
return $matches[3];
}
header('Content-type:text/json');
$phone=$_GET['phone'];
$type_t="";
$txt=get('https://www.so.com/s?q='.$phone);
$info=get_tag("class","mohe-mobileInfoContent",$txt,"td");
$where=get_tag("class","gclearfix mh-detail",$info[0],"div");
if(count($where)==0){//不是骚扰电话
$where=get_tag("class","mh-detail",$info[0],"p");
}
$info_txt= strip_tags ($where[0]);
$info_array=explode(" ",$info_txt);
$phone_t=$info_array[0];
$where_t=$info_array[1];
$cmcc_t=$info_array[2];
$type=get_tag("class","mohe-ph-mark",$info[0],"span");
if(count($type)!=0){
$type_t=$type[0];
}
$result=new Result();
$result->phone=$phone_t;
$result->where=$where_t;
$result->cmcc=$cmcc_t;
$result->type=$type_t;
$json=json_encode($result,JSON_UNESCAPED_UNICODE);
echo $json;
?>
php5.4以上