php做的icp查询

function actionGetIcpData($siteDomain){
  $html_content='';
  $rearray = array();
  if(!empty($siteDomain)){
   $url = 'http://icp.aizhan.com/'.trim($siteDomain);
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,10);//最长时间
   $html_content = curl_exec($ch);
   curl_close($ch);
  }
  header("Content-Type: text/html; charset=utf-8");
  preg_match_all('/<td.*>(.*)<\/td>/iUs',$html_content,$m);
  if(count($m[1])>20&&!empty($m[1])){
   $rearray = array_slice($m[1],0,31);
  }else{
   $rearray = array(0,'您查询的域名 '.$siteDomain.' 未备案。');
  }
  return json_encode($rearray);
}

返回的值里面就有需要的icp备案信息.

你可能感兴趣的:(PHP,icp查询,icp接口,icp查询接口,icp查询)