Ignore SSL Certificate Error with Wget

I have the following code in my coldfusion code that works:

<cfexecute name="curl" arguments = " -k" timeout="10" variable="test" /> <cfdump var="#test#" /> 

This downloads an Excel file from the specified path using cURL and dumps it to the browser, which works fine.

However, I can't get the same thing to work with Wget.

First I tried:

<cfexecute name="wget" arguments = "" timeout="10" variable="test" /> <cfdump var="#test#" /> 

This returns an empty string. It seems we need to use the equivalent of cURL's "-k" for Wget, to tell it to ignore SSL certificate errors. So I tried:

<cfexecute name="wget" arguments = "--no-check-certificate " timeout="10" variable="test" /> <cfdump var="#test#" /> 

This gives me the following results:

Usage: wget [OPTION]... [URL]... Try `wget --help' for more options. 

How can I use Wget within cfexecute to download the excel file, ignoring SSL certificate errors?

EDIT:

Running wget --no-check-certificate "" directly from the command line works.

3

2 Answers

Please use the wget with --no-check-certificate e.g.

wget --no-check-certificate "" should work. 

From the wget man page ()

" HTTPS ( SSL/TLS ) Options

To support encrypted HTTP ( HTTPS ) downloads, Wget must be compiled with an external SSL library, currently OpenSSL. If Wget is compiled without SSL support, none of these options are available."

You might need to check whether the version of wget you are using supports SSL.

Could cfhttp do what you need though?

If you're using a self signed certificate you can add it to your JVM's key store to avoid the certificate errors.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like