app/controllers/application_controller.rb
def verify_recaptcha(remote_ip, params)
    responce = Net::HTTP.post_form(
      URI.parse('http://www.google.com/recaptcha/api/verify'),
      {'privatekey' => APP_CONFIG['recaptcha_private_key'],
        'remoteip' => remote_ip,
        'challenge' => params[:recaptcha_challenge_field],
        'response'=> params[:recaptcha_response_field]})
    result = {:status => responce.body.split("\n")[0],
      :error_code => responce.body.split("\n")[1]}
    if result[:error_code] == "incorrect-captcha-sol"
      flash[:alert] = "The CAPTCHA solution was incorrect. Please re-try"
    elsif
      flash[:alert] = <<-EOF
        There has been a unexpected error with the application.
        Please contact the administrator. error code: #{result[:error_code]}
      EOF
    end
    result
  end
# try and verify the captcha response. Then give out a message to flash
try and verify the captcha response. Then give out a message to flash
try and verify the captcha response . Then give out a message to flash
def verify_recaptcha(remote_ip, params)
    responce = Net::HTTP.post_form(
      URI.parse('http://www.google.com/recaptcha/api/verify'),
      {'privatekey' => APP_CONFIG['recaptcha_private_key'],
        'remoteip' => remote_ip,
        'challenge' => params[:recaptcha_challenge_field],
        'response'=> params[:recaptcha_response_field]})
    result = {:status => responce.body.split("\n")[0],
      :error_code => responce.body.split("\n")[1]}
    if result[:error_code] == "incorrect-captcha-sol"
      flash[:alert] = "The CAPTCHA solution was incorrect. Please re-try"
    elsif
      flash[:alert] = <<-EOF
        There has been a unexpected error with the application.
        Please contact the administrator. error code: #{result[:error_code]}
      EOF
    end
    result
  end
def verify_recaptcha ( remote_ip , params ) responce = Net :: HTTP . post_form ( URI . parse ( 'http://www.google.com/recaptcha/api/verify' ) , { 'privatekey' => APP_CONFIG [ 'recaptcha_private_key' ] , 'remoteip' => remote_ip , 'challenge' => params [ :recaptcha_challenge_field ] , 'response' => params [ :recaptcha_response_field ] } ) result = { :status => responce . body . split ( "\n" ) [ 0 ] , :error_code => responce . body . split ( "\n" ) [ 1 ] } if result [ :error_code ] == "incorrect-captcha-sol" flash [ :alert ] = "The CAPTCHA solution was incorrect. Please re-try" elsif flash [ :alert ] = <<-EOF 
        There has been a unexpected error with the application.
        Please contact the administrator. error code:  #{ result [ :error_code ] } EOF end result end
try and verify the captcha response.
try and verify the captcha response .
remote_ip
params