Category Archives: Programming


Today I made a new PHP script using the TransIP API to update DNS entries. This way it’s possible to automatically update your (dynamic) home IP address for example.

To use this script you need a server with a static IP address and PHP support. If you don’t have a server with a static IP address, free hosting will do the job.

Follow these steps to install this script:

  1. Download the TransIP API to your server
  2. Go to the TransIP CP (My account > API settings)
  3. Enable the API and add your server’s IP address to the list
  4. Add a new Key Pair and copy the key to your clipboard
  5. Edit Transip/ApiSettings.php and set $login and $privateKey (the key you just copied)
    Alternatively you can set this in the script itself, see this comment
  6. Download the script below to your server (dns.php)
  7. Edit the settings in dns.php (domain, key, and records to update)
    This key is used to identify the client, this way the DNS won’t be updated with the IP address of someone else
    Do NOT use the same key as your TransIP API key, the use of a 25 characters long A-Z a-z 0-9 key is recommended
  8. Now, on the client, access dns.php on the server to update the DNS entries
    On Linux you can create a cronjob with the following command (don’t forget to replace the key):
    wget --spider

You’re done. You can test if the script works by openening the URL in your browser and then check if the values are updated in the TransIP CP.

// The domain to edit
define('DOMAIN', '');

// The authentication key
define('KEY', '69l67Le20e819360d3YHO1175');

// The DNS entries to update (name => content)
// This script will NOT add new entries
$newValues = [
  'www' => $_SERVER['REMOTE_ADDR'],

// Exit if the key does not match
if($_GET['key'] != KEY) exit();

// Include the required files from the API

// Get the current DNS entries from TransIP
$dnsEntries = Transip_DomainService::getInfo(DOMAIN)->dnsEntries;

// Check every DNS entry
foreach($dnsEntries as $dnsEntry)
  // Check if the entry has to be updated and update it
  if(array_key_exists($dnsEntry->name, $newValues)) $dnsEntry->content = $newValues[$dnsEntry->name];

  // Commit the changes to the TransIP DNS servers
  Transip_DomainService::setDnsEntries(DOMAIN, $dnsEntries);
  // Done
  echo 'DNS updated.';
catch(SoapFault $f)
  // An error occured
  echo 'DNS not updated. ' . $f->getMessage();

Signing a DLL (Strong Name)

I was working on a project in C# and I had to sign an assembly with a Strong Name.

Here’s how I did that:

  • Go to the project’s properties
  • Go to the tab Signing
  • Check Sign the assembly
  • Choose <New...> from the drop-down list
  • Give it a name (I used my solution’s name) and uncheck Protect my key file with a password

The assembly was signed now. However, when I tried to build it, an error occurred:

Assembly generation failed -- Referenced assembly 'Assembly' does not have a strong name

So the DLL had to be signed, too. Luckily, I had the source of the DLL. It’s also possible to sign a DLL without the source, but this won’t always work.

Sign the DLL using the source

  • Open the project in Visual Studio
  • Follow the steps to sign an assembly above for the DLL (but now use the key you already created by clicking <Browse...> instead of <New...>)
  • Build the DLL

If you get the following error:

Friend assembly reference 'Assembly.Tests' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.

Replace the following values in the commands:

{SNK} The path to the combined key (.snk)
{PUB} The path to public key (will be created)
{KEY} The public key in SHA1 format
  • Double click the error
  • Start Visual Studio’s Developer Command Prompt
  • Issue the following commands:
    sn -p "{SNK}" "{PUB}"
    sn -tp "{PUB}"
  • This will display the public key, copy the public key under Public key (hash algorithm: sha1)
    Don’t copy the public key token!
  • Go back to your project
  • Locate the following line:
    [assembly: InternalsVisibleTo("Assembly.Tests")]
  • Put the public key in the string:
    [assembly: InternalsVisibleTo("Assembly.Tests, PublicKey={KEY}")]
  • Build the DLL

Sign the DLL without the source

Replace the following values in the commands:

{DLL} The path to the original DLL
{IL} The path to .il file (will be created)
{RES} The path to the .res file (located in the same folder as the .il file)
{KEY} The path to the .snk file (the key file)
{DLL2} The path to the signed DLL (will be created)
  • Start Visual Studio’s Developer Command Prompt
  • Run the following commands:
    ildasm "{DLL}" /out:"{IL}"
    ilasm "{IL}" /res:"{RES}" /dll /key:"{KEY}" /out:"{DLL2}"

The DLL has now been signed with your key. Just re-add the reference to the new, signed DLL in your project and rebuild.