调用webservice接口实现几个查询

本博客提供了一个简易的Web界面,用于查询输入手机号码的归属地,并查询指定QQ号码是否在线。通过调用Web服务接口实现查询功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


写着玩玩.....

1. 查询手机号码归属地

<html>
	<head>
		<title>查询手机号码归属地</title>
		<meta charset = 'utf-8'> 
	</head>
	<body>
		<form action = 'Mobilephone.php' method = 'POST'>
			<b>请输入正确的手机号进行查询...</b>
			<input type = 'text' name = 'code' />
			<input type = 'submit' name = 'submit' value = '查询'>
		</form>
	</body>
</html>
	<?PHP
		ERROR_REPORTING(0);
		$code = $_POST['code'];
		 if($_POST['submit']){
			 
			$soapclient = new SoapClient('http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl');
			$result = $soapclient -> getMobileCodeInfo(array('mobileCode' => $code));
			foreach($result as $key => $value){
				echo $value;
			}
			header("content-type:text/html;charset = utf-8");
			$soapclient -> __getLastRequest();  
		 }
		
	
	

2.查询QQ是否在线


<html>
	<head>
		<title>查询QQ是否在线</title>
		<meta charset = 'utf-8'> 
	</head>
	<body>
		<form action = 'qqonline.php' method = 'POST'>
			<b>请输入要查询的QQ号...</b>
			<input type = 'text' name = 'qqCode' />
			<input type = 'submit' name = 'submit' value = '查询'>
		</form>
	</body>
</html>

<?PHP
		ERROR_REPORTING(0);
		$qqCode = $_POST['qqCode'];
		 if($_POST['submit']){
			//wsdl是webservice方法的规格说明书
			$soapclient = new SoapClient('http://webservice.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl');
			$result = $soapclient -> qqCheckOnline (array('qqCode' => $qqCode));
			foreach($result as $key => $value){
				switch ($value){
					case Y:
						echo '在线';
						break;
					case N:
						echo '离线';
						break;
					case E:
						echo 'QQ号码错误';
						break;
					case A:
						echo '商业用户验证失败';
						break;
					default:
						echo '免费用户超过数量';
						break;
				}
				 
			 
			}
			header("content-type:text/html;charset = utf-8");
			$soapclient -> __getLastRequest();
		 }



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值