Last active
October 9, 2017 13:15
-
-
Save rafaelmaeuer/12ef19c12c85c40a23720201ab8560d6 to your computer and use it in GitHub Desktop.
Execute CURL in node.js - From https://stackoverflow.com/questions/7498648/how-to-do-this-curl-operation-in-node-js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
var exec = require('child_process').exec; | |
var command = 'curl -sL -w "%{http_code} %{time_total}\\n" "http://query7.com" -o /dev/null' | |
child = exec(command, function(error, stdout, stderr){ | |
console.log('stdout: ' + stdout); | |
console.log('stderr: ' + stderr); | |
if(error !== null) | |
{ | |
console.log('exec error: ' + error); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment