I realised that I could have spent the last twenty years putting all my tech knowledge online. Well, I didn't, but as they say, the best time to plant trees is 20 years ago, the second best time is now. So here's all the random programming stuff I've come across that might be helpful. Note: this isn't really questions and answers - more just answers from me!

Classic ASP Google recaptcha server-side code

0 votes

I couldn't find the code for server-side for classic ASP for 2.0, as things changed a bit. Here's a working bit of code.

This is based on the old API, but updated to work for the new version, 2.0. 

Assume you set up your FORM correctly, this is on the destination page. 

Dim reChallenge : reChallenge = Request.Form("g-recaptcha-response") 
Dim VarString 
VarString = _ 
"secret=" & Server.UrlEncode("6Lf3RxYOURSECRETCODEHEREbcLCWpAAvrf8-uGjA2h") & _ 
"&response=" & Server.UrlEncode(reChallenge) & _ 
"&remoteip=" & Request.ServerVariables("REMOTE_ADDR") 
Dim objXmlHttp 
Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") 
objXmlHttp.open "POST", "https://www.google.com/recaptcha/api/siteverify", False 
objXmlHttp.setRequestHeader "Content-Length", len(VarString) 
objXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
objXmlHttp.send VarString 
Dim ResponseString 
ResponseString = split(objXmlHttp.responseText, vblf) 
Set objXmlHttp = Nothing 
Response.Write ResponseString(0) 

asked Mar 8 in Classic ASP by Ralpharama (280 points)

Please log in or register to answer this question.