Community discussions

MikroTik App
 
michaelahess
just joined
Topic Author
Posts: 17
Joined: Thu Nov 11, 2010 4:56 am

DDNS Script for DNSPark

Fri Dec 10, 2010 7:53 am

I modified the scripts I found here and can't quite get it to work. It seems to fail at the HTTPS redirect they do. I get error 404. My DynDNS script works beautifully and this is nearly identical.
# Set needed variables
:local username "xxxxxx"
:local password "xxxxxx"
:local hostname "xxxxxx"
:global systemname [/system identity get name]

:if ($systemname  = "Site1" ) do= {
:set hostname "xxxxxxxx"
}

:global dnsparkForce
:global previousIP

# print some debug info
:log info ("UpdateDNSPark: username = $username")
:log info ("UpdateDNSPark: password = $password")
:log info ("UpdateDNSPark: hostname = $hostname")
:log info ("UpdateDNSPark: previousIP = $previousIP")

# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="checkip.dyndns.org" src-path="/" dst-path="/dnspark.checkip.html"
:local result [/file get dnspark.checkip.html contents]

# parse the current IP result
:local resultLen [:len $result]
:local startLoc [:find $result ": " -1]
:set startLoc ($startLoc + 2)
:local endLoc [:find $result "</body>" -1]
:local currentIP [:pick $result $startLoc $endLoc]
:log info "UpdateDNSPark: currentIP = $currentIP"

# Remove the # on next line to force an update every single time - useful for debugging,
#  but you could end up getting blacklisted by DNSPark!

:set dnsparkForce true

# Determine if DNSPark update is needed
# more DNSPark updater request details http://www.dyndns.com/developers/specs/syntax.html
:if (($currentIP != $previousIP) || ($dnsparkForce = true)) do={
    :set dnsparkForce false
    :set previousIP $currentIP
    /tool fetch user=$username password=$password mode=http address="www.dnspark.net" src-path="/api/dynamic/update.php?hostname=$hostname&ip=$currentIP&mx=ON&mxpri=5HTTP/1.0" dst-path="/dnspark.txt"
    :local result [/file get dnspark.txt contents]
    :log info ("UpdateDNSPark: DNSPark update needed")
    :log info ("UpdateDNSPark: DNSPark Update Result: ".$result)
    :put ("DNSPark Update Result: ".$result)
} else={
    :log info ("UpdateDNSPark: No dyndns update needed")
}

Anyone have any thoughts? The error exactly is:
[xxx@xxxx] /log> /system script run DNSPark
  status: finished

  status: failed

failure: 404 Not Found
 
changeip
Forum Guru
Forum Guru
Posts: 3824
Joined: Fri May 28, 2004 5:22 pm

Re: DDNS Script for DNSPark

Fri Dec 10, 2010 6:55 pm

I get a 404 if using the browser:

http://www.dnspark.com/api/dynamic/upda ... ON&mxpri=5

I dont believe RouterOS supports SSL fetch. You should use the ChangeIP.com ddns script since its completely encrypted. :) (self plug)
Colo and Wholesale Bandwidth Available! Sales at SanDiegoBroadband dot com
 
michaelahess
just joined
Topic Author
Posts: 17
Joined: Thu Nov 11, 2010 4:56 am

Re: DDNS Script for DNSPark

Fri Dec 10, 2010 8:25 pm

I guess maybe I don't understand fully. I thought your script only worked with changeip.com?

Who is online

Users browsing this forum: No registered users and 15 guests