Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 22, 2020. It is now read-only.

HFIProgramming/whatip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

60 Commits

Repository files navigation

whatip

A light php API to get your IP, and more.

说明

https://www.v2ex.com/t/386624
有业务需要本地客户端看外网 IP,就做了一个小轮子(后面才看到 https://ip.sb ,但是做都做了 233,就当记录一下吧)

  • 地址:

    • whatip.ga
    • whatip.ml
    • whatip.cf
      地址的作用都是等同的,区别就是 ga 和 ml 都强制 https,cf 没有
  • 功能

  • IP Address In Plain Text

    • 直接访问即可,或者命令行 curl https://whatip.ga
  • /json 获取 JSON 格式

  • 顺便做了一点其他(没卵用)的......

  • /ping

    • 返回 pong
  • /base64/{content} or /?base64={content}

    • 转换 base64
    • 解密 /decode?base64={content} or /base64/{content}/decode
  • /generate_204 or /204

    • header 204 no content
  • /to/{base64}

    • 发送 302 跳转到 base64 编码后的地址,等同 -> Location: //{Decoded Content}
    • /to/{base64}/http/to/{base64}/https{Decoded Content} 加上前缀
    • /to/{base64}/origin 等同 -> Location: {Decoded Content}
  • /getHeader

    • 以 JSON 格式返回当前收到的 Header 信息
  • /getUserAgent

    • 以 Plain text 返回当前的 UserAgent

提示:抑制了所有的错误信息,如果收到空白,除了可能是输入不对,也可能是 500

  • 异常需要有多一点处理

部署在 Hostker 上面,速度还是不错的,有比较冷门需求的就拿去玩玩咯
没有留任何记录(懒),Apache2 的访问记录除外(这个也不会去看的)
还不支持 IPV6,找时间会加上

简化成一个文件

Class里面的东西放进Index就好了......

About

A light php API to get your IP, and more.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /