hello.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <!DOCTYPE html><head><meta charset="utf-8">
  2. <title>Hello,亲: 本WebAPI支持IP城市定位和域名查IP定位</title>
  3. </head>
  4. <html><body style="text-align:center;">
  5. {% if ip %}
  6. <h2>Hello, 来自 {{ city }} 的亲:</h2>
  7. <a href="https://262235.xyz/ip/maps/"> <img style="margin:5px"
  8. src="https://api.map.baidu.com/staticimage/v2?ak=tF8XaCqUG9ZjFR66lqqNXmLzeT24gtGF&mcode=666666&center=110,35&width=500&height=300&zoom=4 "/>
  9. </a>
  10. <h3>{{ ipaddr }}: <a href="https://262235.xyz/maps.php?city={{ city }}">查看地图</a></h3>
  11. {% else %}
  12. <h1>Hello World!</h1>
  13. {% endif %}
  14. <div>IP/域名: <input id="name" type="text">
  15. <input type="button" id="btn" value="提交">
  16. <input type="button" id="json" value="获得json"></div>
  17. <script src="https://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  18. <script>
  19. $("#btn").click(function () {
  20. jump_url()
  21. })
  22. function jump_url(params) {
  23. var name = $("#name").val();
  24. const url = window.location.href;
  25. window.location.href = '/ip/' + name
  26. }
  27. $("#json").click(function () {
  28. getjson()
  29. })
  30. function getjson(params) {
  31. var ip = $("#name").val();
  32. const url = 'https://api.map.baidu.com/location/ip?ak=tF8XaCqUG9ZjFR66lqqNXmLzeT24gtGF&ip=';
  33. window.location.href = url + ip + '&coor=bd09ll'
  34. }
  35. </script>
  36. <br>
  37. <form action="/ips/" method="post">
  38. <legend>批量ip查询地址:</legend>
  39. <textarea type="text" name ="ips" cols=120 rows=20 placeholder="输入多行包含ip地址的日志,例:
  40. http://192.168.1.189:5000/ips/
  41. 172.67.158.52 cloudflare.com"></textarea>
  42. <br>
  43. <input type="submit" value="点击查询">
  44. </form>
  45. <br>
  46. 本WebAPI支持IP城市定位和域名查IP定位,同时支持命令行查询<br>
  47. <br>github源码:<a href="https://github.com/hongwenjun/ip">https://github.com/hongwenjun/ip</a>
  48. <br>
  49. <br>docker镜像:<a href="https://hub.docker.com/r/hongwenjun/ip">https://hub.docker.com/r/hongwenjun/ip</a>
  50. <h3>搭建WebAPI参考文章</h3>
  51. <a href="https://262235.xyz/index.php/archives/342/">Python网络开发简单的IP城市定位WebAPI</a>
  52. <p>
  53. <h3>命令行 curl 使用:</h3>
  54. <pre>
  55. curl https://262235.xyz/ip/ # 命令行 URL 要带 /
  56. curl https://262235.xyz/ip/8.8.8.8 # 查询自定义 IP 定位
  57. curl https://262235.xyz/ip/github.com # 按域名查 IP 定位