当前位置:首页 > 编程世界 > 正文内容

分享给大家一个携号转网和归属地查询接口,数据来自中国联通实时数据哦,非常准确

李大敬3年前 (2022-03-04)编程世界32470

 

接口地址       https://www.love1314.xin/code/area/index.php?phone=13771942591

 

正确的返回  

{
    "pro""江苏",
    "city""苏州",
    "op""中国移动",
"isxie""正常"
}

 

附上HTML代码

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>携号转网和归属地查询</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            color: #333;
            text-align: center;
            padding: 20px;
        }
        h1 {
            color: #4CAF50;
        }
        form {
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            max-width: 400px;
        }
        input[type="text"] {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        button {
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        button:hover {
            background-color: #45a049;
        }
        #result {
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            max-width: 400px;
        }
    </style>
</head>
<body>
    <h1>携号转网和归属地查询</h1>
    <form id="queryForm">
        <label for="phoneNumber">手机号:</label>
        <input type="text" id="phoneNumber" name="phoneNumber" required>
        <button type="submit">查询</button>
    </form>
    <div id="result"></div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script>
        $(document).ready(function() {
            $('#queryForm').on('submit', function(event) {
                event.preventDefault();
                var phoneNumber = $('#phoneNumber').val();
                
                $.ajax({
                    url: `https://www.love1314.xin/code/area/index.php?phone=${phoneNumber}`,
                    method: 'GET',
                    success: function(data) {
                        $('#result').html(`
                            <p><strong>省份:</strong> ${data.pro}</p>
                            <p><strong>城市:</strong> ${data.city}</p>
                            <p><strong>运营商:</strong> ${data.op}</p>
                            <p><strong>协转状态:</strong> ${data.isxie}</p>
                            
                        `);
                    },
                    error: function(error) {
                        $('#result').html(`<p>查询失败: ${error.responseText}</p>`);
                    }
                });
            });
        });
    </script>
</body>
</html>

扫描二维码推送至手机访问。

版权声明:本文由爱一生一世的心发布,如需转载请注明出处。

本文链接:https://www.love1314.xin/post/236.html

分享给朋友:

相关文章

网站DEDE织梦系统列表页中的页码竖着的解决办法

.(列表翻页效果修改)找到/include/arc.listview.class.php 查找:<li>?全部替换为"空" 查找:<>全部替换为"空" 查找:<li?class=\"thisclass\"...

php教程之操作数据库

最近在学新的语言PHP,花了小半天看了看php操作数据库的方法,其实还是很简单的,比C更容易上手。好吧,我贴出来做个记录。<?php $servername="localhost"; $username=&qu...

PHP教程之从数据库中读取数据

<?php $servername="localhost"; $username="root"; $password="root"; //建立连接 $con=mys...