0

I need to make a request to an URL of my app, every 15 minutes(not hosting scheduled tasks), and I don't want anything sophisticated, just something simple, so I end up with this 2 solutions:

  • Windows 7 scheduler + PowerShell Script
  • Windows 7 scheduler + Curl request

Is there something else, similar, that I can do ?

Which of the 2 approaches is best ?

I really appreciate if someone can show me how to make a PowerShell Script doing an URL request or how to schedule on windows 7 a curl request.

Daniel Romero
  • 1,581
  • 1
  • 20
  • 33
  • This SO question has some pointers wrt making HTTP requests from PowerShell: http://stackoverflow.com/questions/340553/what-is-the-best-way-to-send-http-requests-from-windows-powershell. It's easy to create and use managed objects from PS. – Ian Gilroy May 24 '12 at 11:40

2 Answers2

2

If you have PowerShell 3 at hand, you could use the brand new Invoke-WebRequest in your scheduled script. But having something similar to curl in PowerShell is relatively easy. From the article mentioned:

$document = New-Object -ComObject msxml2.ServerXMLHTTP
$document.open("POST", "https://www.somewhere.com", $false)
$document.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")

$postline = " <Blah> "

$document.send($postline)
David Brabant
  • 41,623
  • 16
  • 83
  • 111
0

You can also try a web based request scheduler like iHook. If your app is not publicly accessible, you might also need a tunneling tool like ngrok.

Yuming Cao
  • 935
  • 1
  • 10
  • 22