hello.html 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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><br><br><br><br><br>
  37. 本WebAPI支持IP城市定位和域名查IP定位,同时支持命令行查询<br>
  38. <br>github源码:<a href="https://github.com/hongwenjun/ip">https://github.com/hongwenjun/ip</a>
  39. <br>
  40. <br>docker镜像:<a href="https://hub.docker.com/r/hongwenjun/ip">https://hub.docker.com/r/hongwenjun/ip</a>
  41. <h3>搭建WebAPI参考文章</h3>
  42. <a href="https://262235.xyz/index.php/archives/342/">Python网络开发简单的IP城市定位WebAPI</a>
  43. <p>
  44. <h3>命令行 curl 使用:</h3>
  45. <pre>
  46. curl https://262235.xyz/ip/ # 命令行 URL 要带 /
  47. curl https://262235.xyz/ip/8.8.8.8 # 查询自定义 IP 定位
  48. curl https://262235.xyz/ip/github.com # 按域名查 IP 定位