In ColdFusion, you can get the protocol from a URL using the getPageContext().getRequest().getScheme()
method. This method returns the scheme (i.e., the protocol) used for the request, such as “http” or “https”. Here is an example:
<cfset url = "https://www.example.com/page.cfm">
<cfset protocol = getPageContext().getRequest().getScheme()>
<cfoutput>
The protocol for the URL #url# is #protocol#.
</cfoutput>
In this example, the getPageContext().getRequest().getScheme()
method is used to retrieve the protocol (“https”) from the URL “https://www.example.com/page.cfm“. The output of this code would be “The protocol for the URL https://www.example.com/page.cfm is https.”
0 Comments