Posted By

madc on 06/19/11


Tagged

ip update client DynDNS


Versions (?)

Own DynDns Service, clientside script.


 / Published in: Ruby
 

URL: http://madcity.at/

Clientside script for a personal DynDNS service. Works together with a server-side script written in php [ http://snipplr.com/view/55482/own-dyndns-service-serverside-script ] .

You may want to set up a cron jop to run this script every x minutes.

  1. require 'uri'
  2. require 'net/http'
  3.  
  4. url = "http://dynDNS.yourveryownhost.com"
  5. params = {
  6. 'updateIp'=>'',
  7. }
  8.  
  9. parsedUrl = uri = URI.parse( url );
  10.  
  11. http = Net::HTTP.new(parsedUrl.host, parsedUrl.port)
  12. request = Net::HTTP::Get.new(parsedUrl.path)
  13. request.set_form_data( params )
  14.  
  15. request = Net::HTTP::Get.new( parsedUrl.path+ '?' + request.body )
  16.  
  17. response = http.request(request)
  18. puts response.body

Report this snippet  

You need to login to post a comment.