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);
} html

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

相关文章
相关标签/搜索