Archive: Trying to return data from CURL.exe using ExecDos::exec

Trying to return data from CURL.exe using ExecDos::exec
I have tried to use ExecDos::Exec to call cURL.exe from NSIS and receive the output from the webserver. however, despite trying many different things, (including options for ExecDos like /TOSTACK, and command line options for CURL) I can't get the actual CURL output (the HTML returned from the webserver) back into NSIS.

After I call:
ExecDos::exec "curl" "
Pop $connectResult

$ConnectResult just contains an integer that represents the return code of the process. How do I get ConnectResult to contain the actual data returned from the webservice call?

Answering my own question... What you have to do is first pop the returncode off the stack, then the stack will contain the web response, e.g.:

ExecDos::exec /TOSTACK "curl -s"
Pop $responsecode
Pop $responsebody

You should add two empty arguments to the end (for stdin_string and log_file_name) otherwise, if the stack is not empty, you can have some unexpected results which may drive you mad in future.

Edit: Also make sure you give a full quoted path to curl.exe. Relative paths are never a good idea.