php用于检查URL和电子邮件检查

<!DOCTYPE html>
<html>
	<head>
		<title>Site submission results</title>
		<meta charset="utf-8">
	</head>
	<body>
		<?php
			$url = $_REQUEST['url'];
			$email = $_REQUEST['email'];
			$url = parse_url($url);//返回包含url不同部分的相关数组
			$host = $url['host'];//主机
			if(!($ip = gethostbyname($host)))
			{
				echo 'Host for URL does not have valid IP';
				exit;
			}
			echo '主机IP是' . $ip . "<br />";
			
			$email = explode('@', $email);
			$emailhost = $email[1];
			
			if(!dns_get_mx($emailhost, $mxhostsarr))
			{
				echo 'Email address is not valid host';
				exit;
			}
			
			echo '邮件交换记录';
			foreach($mxhostsarr as $mx)
			{
				echo $mx . ' ';
			}
		?>
	</body>
</html>


猜你喜欢

转载自blog.csdn.net/liu2446426696/article/details/59174494