How to get external IP successfully

前端 未结 9 1231
耶瑟儿~
耶瑟儿~ 2020-12-03 16:16

After reading: Getting the 'external' IP address in Java

code:

public static void main(String[] args) throws IOException
{
    URL whatismyip         


        
相关标签:
9条回答
  • 2020-12-03 17:09

    While playing with Go I saw your question. I made a quick App on Google App Engine using Go:

    Hit this URL:

    http://agentgatech.appspot.com/

    Java code:

    new BufferedReader(new InputStreamReader(new URL('http://agentgatech.appspot.com').openStream())).readLine()
    

    Go code for the app which you can copy and make your own app:

    package hello
    
    import (
        "fmt"
        "net/http"
    )
    
    func init() {
        http.HandleFunc("/", handler)
    }
    
    func handler(w http.ResponseWriter, r *http.Request) {
        fmt.Fprint(w, r.RemoteAddr)
    }
    
    0 讨论(0)
  • 2020-12-03 17:10

    You can use another web service like this; http://freegeoip.net/static/index.html

    0 讨论(0)
  • 2020-12-03 17:11

    We've set up CloudFlare and as designed they're challenging unfamiliar useragents. If you can set your UA to something common, you should be able to gain access.

    0 讨论(0)
提交回复
热议问题