curl: an alternative for cfhttp

When I first started programming in ColdFusion I used the cfhttp tag quite a lot. However, the cfhttp does not have an insecure option. This means you have to install the website certificate for each website you wish to connect to. As far as I know, this cannot be automated. And btw installing a certificate in the ColdFusion truststore is somewhat of a hassle (more info: https://helpx.adobe.com/coldfusion/kb/import-certificates-certificate-stores-coldfusion.html )

Curl to the rescue.  Curl is a command-line program to communicate to or from a server. Curl is available for many operating systems including Windows and Unix.

Curl has an insecure flag  -k or –insecure. This means curl will skip the certificate validation. Of course, this makes the connection way less secure and you should not send your credit card information over the internet using this flag. However in many cases this is not a problem at all. Furthermore as far as i know the -k or –insecure flags does not mean the data itself is no longer encrypted. It only means the validation of the certificate is skipped. More information about curl can be found here: https://curl.se/docs/manpage.html


<cfexecute 
	name = "#Path_To_Curl_Folder#curl.exe"
	arguments = "--insecure https://www.bing.com/search?q=test&form=QBLH"
	variable="response"
	timeout = "20">
</cfexecute>

<Cfdump var=#response#>

Leave a Reply

Your email address will not be published. Required fields are marked *