Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfscript>
- //Validate captcha
- if(structkeyExists(form,'g-recaptcha-response')){
- //Create new HTTP object
- httpService = new http();
- httpService.setMethod("GET");
- httpService.setUrl( "https://www.google.com/recaptcha/api/siteverify" );
- //Set HTTP parameters
- httpService.addParam(type="formfield", name="secret", value="YOUR SECRET KEY GOES HERE");
- httpService.addParam(type="formfield", name="response", value="#form['g-recaptcha-response']#");
- httpService.addParam(type="formfield", name="remoteip", value="#cgi.remote_addr#");
- //Parse Response and do error code
- httpResponse = httpService.send().getPrefix();
- temp = deserializeJSON(httpResponse.filecontent);
- if(temp.success == 'no'){
- arrayAppend(variables.errors_array,'Please check the captcha.');
- }
- }
- </cfscript>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement