0

My bash emulator can run curl command correctly. But when I call it within nodejs with child_process module, I get an error refering to Protocol "'https" not supported or disabled in libcurl.

When I run "curl 'https://ehire.51job.com/Candidate/SearchResumeNew.aspx'" I can get a page content.

Here's the nodejs code below:

var child_process = require("child_process");
var curl = "curl 'https://ehire.51job.com/Candidate/SearchResumeNew.aspx'";
var child = child_process.exec(curl, (err, stdout, stderr) =>
{
    console.log(stdout);
    console.log(err);
    console.log(stderr);
});

screenshot

urcllr
  • 1
  • 1
  • I tried this exact same code and there seem to be no error. Except variables `stdout`, `stderr` have no value and `err` is `null`. – Saharsh Sep 26 '19 at 12:47

1 Answers1

0

Referencing this, exchanged the double quotes with single quotes and vice-versa, the following code works:

var child_process = require("child_process");
var curl = 'curl "https://ehire.51job.com/Candidate/SearchResumeNew.aspx"';
var child = child_process.exec(curl, (err, stdout, stderr) =>
{
    console.log(stdout);
    console.log(err);
    console.log(stderr);
});