Tuesday, February 6, 2024

[SOLVED] Curl will not write errors out to a file

Issue

I am looking to build an application that will tell the user if the port/address is open. I am unable to write failures to the file though.

I have tried using Curl to do this.

curl google.com:8099 --fail --show-error >”C:\Users\Ryan Lambert\Desktop\Curl.txt” && echo Success. || echo Fail.

Need to have errors come through in the file but file is empty. Running this in command line.


Solution

You want stderror, not stdout

For example:

curl sosdlfjsdlfkj 2> log.something.error

This would write the errors to the error log.



Answered By - Vaughan Hilts
Answer Checked By - Clifford M. (WPSolving Volunteer)