Introduction: How to Host Your Dynamic DNS for Free
OK, now a dynamic DNS is like a message board where you put your IP address and where it is associated with a name like 220.127.116.11 is associated with www.google.com . Now you can use a free dynamic dns service here you got a list of service providers ( http://dnslookup.me/dynamic-dns/ ).
Now if you need more that just that, like a fast dynamic DNS that acts more like a API (Application Program Interface), where the username association to IP address can be timed to your needs, like a dynamic DNS service account that has a TTL (Time To Live) of 30 seconds, or whatever you need as time interval. The access mode to this API is made with the help of GET method, this way is very easy to integrate in software, scripts or whatever you need. This goes like this:
http://www.somesite.com/phpnoip.php?op=get&name=someuser will get the IP address of the user someuser and
http://www.somesite.com/phpnoip.php?op=set&name=someuser will detect your current external IP and set it for the user someuser . And if you need a list of all users that are registered use the following
Step 1: Instalation
You just need a web server with APC (Alternative PHP Cache) extension enabled. For testing purposes or hosting it on a own machine use ZWAMP ( http://zwamp.sourceforge.net/ ). All is self contained in a single PHP file.
You can download it or see the source code from here or at pastenin.com ( http://pastebin.com/GNtUrAh5 ).
The 3 methods to use are :
• www.yoursite.com/phpnoip.php?op=set&name=someuser (this set the curent ip to username someuser)
• www.yoursite.com/phpnoip.php?op=get&name=someuser (this get the ip sotred for username someuser)
if someuser is not present it displays nothing if no user is stored in cache it displays NONE
• www.yoursite.com/phpnoip.php?op=lst (this will display a list of all users stored separated with the char ' • ')
• if you open phpnoip.php at the 3rd line you find the TTL settings, default is 60 ( constTIME=60; ) change it to any value you need, the value represent seconds.
(Observation 1 need to be followed if you dont use the ZWAMP package)
1. In your php.ini configuration file you need to have the APC extension enabled.
BTW you need to have the extension downloaded and extracted in your /php/ext folder
2. You can easy add a password protection if you want that but i think it is not needed as this project is used to get the current IP of a requested user. The rest of connection will be from user to user. This type of project is very good for server less networks, P2P, for exchanging IP addresses of users at initialization. All clients will know the fixed address of a normal web server (free host or not) and they will use that for initiating P2P connections. All data will be erased when the time expires or when the server reboots.
3. You can host your own Apache + PHP + APC extension in a free or paid VPS (Virtual Private Server) free VPS here.
4. This type of IP exchange can be achieved with the combination of PHP and MySQL too, but you need to handle the delayed time remove of expired records by your own code, still it is doable in near the same number of code lines.
5. This can be done useing a torrent tracker as IP exchange still not in PHP and by far not as easy as this or the MySQL version.
At this address i have a working copy of the SQL version running (TTL 30 seconds) :
Replace somename with the username you need. The list operation (op=lst) does not work with this provider, the ads code is messing with the list function resulting in a blank page. Still the code works for ADS FREE web hosts, like the www.awardspace.com
At this address i have a working copy of the SQL version running (TTL 60 seconds) :
http://ipapi.atwebpages.com/?op=set&name=somename (this will store IP address of user somename)
http://ipapi.atwebpages.com/?op=get&name=somename (this will return the IP address of user somename)
http://ipapi.atwebpages.com/?op=lst (this will return the list of users currently registered)
The SQL version at www.awardspace.com uses instead of the normal separation character ' • ' the more common character ' * '.
We have a be nice policy.
Please be positive and constructive.