Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have this DNS dynamic service and I need to find a way to call the API to update my dynamic IP.

The URL that needs to be call is just a .php with some GET parameters.

Is there a way to do it in CMD? Or maybe Powershell? I really looking for a very lightweight way, because this will be triggered every 1 hour.

Thanks

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Download cURL for Windows and schedule a job that calls it, or a .cmd file which does what you need.

share|improve this answer

In powershell v2 there is no built-in cmdlet for this, but it's still fairly simple using the WebClient class:

$wc = new-object System.Net.WebClient
$wc.DownloadString('http://www.google.com') | Out-Null  # ignore the response if just calling an API

Put that in a file with a .ps1 extension, then invoke via a schedule like this

powershell.exe -executionpolicy unrestricted -file C:\scripts\webapi.ps1

In powershell v3 (default in Win8/Server 2012, also now released for downlevel OS), there is a new built-in cmdlet Invoke-WebRequest which does bascially the same thing, but is packaged nicely and has some other bells and whistles.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.