It's a local file. I was afraid that cfhttp would not be as safe as cffile.
Okay, so this is what I have in cftthp: <cfhttp url="https://devbox.mysite.com/search/KOGroups.json" method="get" timeout="15" />
However, when I try the fileread I have this:
<cfset kogroups = deserializeJSON(fileread(#KOGroups.json#)) />
My question now is, how do specify the path in the fileread above?
Again, if it's a local file, why are you using CFHTTP? Just use CFFILE with the "read" action to read the contents into a variable, then use deserializeJSON on that variable.
As I've said above, I tried to use the <cfset kogroups = deserializeJSON(fileread(#KOGroups.json#)) /> but I'm not sure how to specify the path. It's unable to find the file. The actual location of the KOGroups.json is located in a shared folder and not on the IIS server. The path is "https://devbox.mysite.com/search/KOGroups.json but I'm not sure how to specify a relative path instead of a absolute path.
Okay, that works and many thanks for that but since both cffile and cfhttp use the "https" path, is there any security advantage of one over the other?
That question only has theoretical interest. Cffile and cfhttp are making the calls within Coldfusion, so they are both secure. (In the sense that, in either case, an outsider will be unable to access the data)
Okay, something odd happened. It's now giving me this error:
Error in custom script module
An error occurred when performing a file operation exists on file /search/KOGroups.json.
The cause of this exception was: org.apache.commons.vfs2.FileSystemException: Could not determine the type of file "https://devbox.mysite.com/search/KOGroups.json"
This is my code:
<cfset groupData = deserializeJSON(fileread("https://devbox.mysite.com/search/KOGroups.json")) />
Okay, some help from my other thread, I found that using expandPath('fileName') will generate the absolute path and that seems to work. So for my future reference, this is the code that works:
<cfset groupData = deserializeJSON(fileread(\\commonspotshare.mysite.com\commonspot$\DEVELOPMENT\devbox.mysite.com\kb\article\KOGroups.json)) />