CFML Recaptcha JSON Parse Issues

78 Views Asked by At

So my code has been working for about 1 year and all of a sudden I am getting the follow error from the ReCaptcha Return.

"Error","ajp-bio-8014-exec-530","05/16/23","22:17:54","F9CCA4902D7344AC3751382EAE48C4F4","JSON parsing failure at character 1:'C' in Connection Failure The specific sequence of files included or processed is: D:\home\beantownaquatics.com\wwwroot\contact.cfm, line: 8 "

at cfcontact2ecfm2061962498.runPage(D:\home\beantownaquatics.com\wwwroot\inc\contact.cfm:8)

at cfcontact2ecfm299516155.runPage(D:\home\beantownaquatics.com\wwwroot\contact.cfm:45)

This is my code for the return.

<script src="https://www.google.com/recaptcha/api.js?render=6Le6210aAA7AAGr8_L2tqNZ2DH-RMP8KRgtPCBGZ"></script>
<!-- CSS only -->
    
<cfif ISDEFINED('FORM.name')> <!--- check if form was submitted and if so run code below --->

    <cfhttp url="https://www.google.com/recaptcha/api/siteverify?secret=6Le6210aAAAA7C2zZfRTJ-_geqP8bJqK8hUgO9pc&response=#FORM['token']#" result="Response" />
    <cfset Return = deserializeJSON(Response.FileContent) />

    <cfif Return.success IS 'true' AND Return.score GT 0.5> <!--- check if true and if score is greater than 0.5. Run code below if all good. --->

Please let me know your thoughts.

1

There are 1 best solutions below

0
rrk On

I think you'll need to do something like this since siteverify endpoint is POST method.

<cfhttp url="https://www.google.com/recaptcha/api/siteverify" method="post" result="Response">
    <cfhttpparam type="formfield" name="secret" value="#secret#">
    <cfhttpparam type="formfield" name="response" value="#FORM['token']#">
</cfhttp>