Skip to content

Instantly share code, notes, and snippets.

@rgl
Created December 25, 2011 08:56
Show Gist options
  • Save rgl/1518960 to your computer and use it in GitHub Desktop.
Save rgl/1518960 to your computer and use it in GitHub Desktop.
Update a namecheap dynamic DNS address

See http://www.namecheap.com/support/knowledgebase/article.aspx/29/11/how-to-use-the-browser-to-dynamically-update-hosts-ip

Do an HTTP GET to (and replace the VARIABLES):

https://dynamicdns.park-your-domain.com/update?host=HOST&domain=DOMAIN&password=PASSWORD&ip=IP_ADDRESS

eg. to update the local.statica.info DNS A record:

https://dynamicdns.park-your-domain.com/update?host=local&domain=statica.info&password=PASSWORD&ip=127.1.0.1

A succeeded request will return something like:

<?xml version="1.0"?>
<interface-response>
  <Command>SETDNSHOST</Command>
  <Language>eng</Language>
  <IP>127.1.0.1</IP>
  <ErrCount>0</ErrCount>
  <ResponseCount>0</ResponseCount>
  <Done>true</Done>
  <debug><![CDATA[]]></debug>
</interface-response>

NB: make sure the /interface-response/IP node exists and has the correct value.

A failed request will return something like:

<?xml version="1.0"?>
<interface-response>
  <Command>SETDNSHOST</Command>
  <Language>eng</Language>
  <ErrCount>1</ErrCount>
  <errors>
	<Err1>No Records updated. A record not Found;</Err1>
  </errors>
  <ResponseCount>1</ResponseCount>
  <responses>
	<response>
	  <ResponseNumber>380091</ResponseNumber>
	  <ResponseString>No updates; A record not Found;</ResponseString>
	</response>
  </responses>
  <Done>true</Done>
  <debug><![CDATA[]]></debug>
</interface-response>

NB: don't rely on the HTTP status code; it will be 200 in case of errors too...

NB: you can create an error message by concatenating all /interface-response/errors/*/text() nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment