IP Address different from GNet?
BlitzMax Forums/BlitzMax Beginners Area/IP Address different from GNet?
| ||
Anyone know a way to get the IP address of the system when hosting on GNet. I have looked at HostIp to no avail as this report the same as ipconfig which is the address of my router. Is there any way of getting the actual proper ip address like the one that appears on GNet? |
| ||
make a little php script, put it on your webserver. make this script echo only the connectors ip and parse that data. or use regex and connect to http://www.whatismyip.com ... |
| ||
Here's the php script:<?php $ip = GetHostByname($_SERVER['REMOTE_ADDR']); echo "$ip"; ?> Host that as ip.php and use this in Bmax to retrieve your ip address. ' Find external ip via php Local myip:TStream = ReadStream("http::www.whatever.com/ip.php") Global ipstring:String = ReadLine(myip) CloseStream myip |
| ||
my system doesnt come back with the IP just whats in the php file, its like I opened the file and read it. |
| ||
Does the place where you put it have PHP support? If not you'll just get the PHP file downloaded. [edit] Try this - works fine for me: Local myip:TStream = ReadStream("http::www.desktopgaming.net/ip.php") Global ipstring:String = ReadLine(myip) CloseStream myip Print ipstring |
| ||
there's also a couple of free websites that will give you this info, such as: http://www.ippages.com/simple/ (100 lookups per IP per day) or http://checkip.dyndns.org/ (free for DynDNS users) |
| ||
Gfk: works fine here too, I guess my website doesnt have php support :( |
| ||
If you are using a free one, perhaps not or it embbeds pages which will cause problems as well. if you pay for it, ask the support how to get it. with php4 and 5 installed parallel, it might be that you have to use php4 / php5 as extensions |
| ||
Yep, with my hosting package, .php is PHP4, if you want to use PHP5, files need to have a .php5 extension. Bit silly, really. Edzup - try www.z-host.com if you're on a budget. I got a years worth of hosting plus my domain name for less than £20 per year. In all honesty, their customer services are a bit crappy, but thankfully I haven't needed them too often anyway. [edit] Just checked webstats - that ip.php page on my site has had over 50 hits in 24 hours, and this is the only place I've posted it. Just a note of caution - don't rely on this because I'm going to remove the file later. I only put the file there to check that the suggested solution to this problem did actually work. |
| ||
What I might try and do is remote connect to my own server and get the ip that way, hopefully that will work. Will have a look at z-host too :D |