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