0

I can't really find an example of cfhttp method=options.

I am seeing documentation on many websites that cfhttp has a method named options, but they don't really show how we can make it work. I tried to search for http options but could not get much about how to use it, what is the practical use of this and how it can be implemented.

Community
  • 1
  • 1
whole3
  • 19
  • 2
  • 1
    Try something and if it works great. If not, SO is a great place to post a question on how to get it to work for your needs. – James A Mohler Apr 22 '18 at 18:07
  • 1
    What are you trying to accomplish that might involve the cfhttp tag? – Dan Bracuk Apr 22 '18 at 19:09
  • Your question is unclear. What do you mean by "options"? For questions about how to use the `cfhttp` tag, in general, start with [the documentation](https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-g-h/cfhttp.html). If you are asking about *http OPTION*, that is a different question altogether. Either way, can you please clarify your question? – SOS Apr 24 '18 at 15:53
  • `cfhttp` method has the `options`, what is the purpose? – whole3 Apr 24 '18 at 23:28

1 Answers1

2

This is from ColdFusion 9 docs, in my opinion the official docs for more recent ColdFusion versions are not presented very well, so, I always go back to cf9 docs if I can. There is some code example there too.

https://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7ffc.html

<cfhttp  
    url = "server URL" 
    charset = "character encoding" 
    clientCert = "filename" 
    clientCertPassword = "password" 
    columns = "query columns" 
    delimiter = "character" 
    file = "filename" 
    firstrowasheaders = "yes|no" 
    getAsBinary = "auto|yes|no|never" 
    method = "method name" 
    multipart = "yes|no" 
    name = "query name" 
    password = "password" 
    path = "path" 
    port = "port number" 
    proxyServer = "host name" 
    proxyPort = "port number" 
    proxyUser = "username" 
    proxyPassword = "password" 
    redirect = "yes|no" 
    resolveURL = "yes|no" 
    result = "result name" 
    textQualifier = "character" 
    throwOnError = "yes|no" 
    timeout = "time-out period in seconds" 
    username = "username" 
    userAgent = "user agent"> 

    cfhttpparam tags [optional for some methods] 

</cfhttp>

Another good resource is https://cfdocs.org/cfhttp which has examples with the script syntax, something like:

cfhttp(method="GET", charset="utf-8", url="https://www.google.com/", result="result") {
    cfhttpparam(name="q", type="formfield", value="cfml");
}
writeDump(result);

Also, the current official Adobe ColdFusion documentation can be found at https://helpx.adobe.com/coldfusion/cfml-reference/user-guide.html

Alex Baban
  • 11,312
  • 4
  • 30
  • 44