PHP随机获取未被微信屏蔽的域名(微信域名检测)

作者:袖梨 2022-06-24
 
 代码如下复制代码
$con = get_msg($url);
$data = json_decode($con,true);
$count = count($data)-1;
$rand = rand(0,$count);
echo $data[$rand]['domain'];
function get_msg($url){
 $ch = curl_init();
 curl_setopt($ch,CURLOPT_TIMEOUT,1);
 curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch,CURLOPT_URL,$url);
 curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
 curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
 $data = curl_exec($ch);
 if($data){
  curl_close($ch);
  return $data;
 }else {
  $error = curl_errno($ch);
  curl_close($ch);
  return false;
 }
}
 

相关文章

精彩推荐