What's my IP?

Previous topic - Next topic

Kitty Hello

Code (glbasic) Select

STDOUT "Local IP(s) (for LAN connection): \n" _
+ REPLACE$(NETGETIP$(), "|", "\n")+"\n"

LOCAL myip$, proxy$, port%
// proxy$ = ""
// port   = 3128

IF port=0 OR LEN(proxy$)=0
// direct connection
myip$=NETWEBGET$("www.whatismyip.com", "/automation/n09230945.asp", 80, 512)
// through proxy server
myip$=NETWEBGET$(proxy$, "http://www.whatismyip.com/automation/n09230945.asp", port, 512)

STDOUT "Internet IP:\n"+myip$+"\n"


That code snippet appears to be wrong. When specified with a proxy, the last field is the file to write the contents of the webpage to, not the number of bytes to read.

Kitty Hello

don't mix NETWEBGET and NETWEBGET$ !!!


I'll test it again tomorrow when I'm at work (ie. behind a proxy) - the documentation is missing in the helpfile for forms of NETWEBGET other than
Code (glbasic) Select
contents$ = NETWEBGET$(server$, path$, port%, max_length%)