Advertisement
Guest User

ReCaptcha TEC Digital

a guest
Dec 8th, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 2.02 KB | None | 0 0
  1. PROCEDIMIENTO
  2. =============
  3.  
  4. ad_proc -public subsite::verifyRecaptcha {
  5.     -token
  6. } {
  7.     sdafsdf sdfsdf sdf
  8. } {
  9.       # VV - PENDIENTE ELIMINAR CODIGO BASURA
  10.       puts "##############################################"
  11.       puts "##############################################"
  12.       puts "##############################################"
  13.       puts "##############################################"
  14.       #set data [string map { á a é e í i ó o ú u ñ n Á A É E Í I Ó O Ú U Ñ N ü u Ü U } $data]
  15.       set hdr {Accept application/json Content-Type application/json}
  16.  
  17.       set body "{\"secret\": \"<<<<<<<<<PONER SECRET TOKEN AQUI>>>>>>\",\"response\": \"$token\"}"
  18.      
  19.       set theurl "https://www.google.com/recaptcha/api/siteverify"
  20.       #:43830
  21.  
  22.       # HTTP access
  23.       #puts "body $body"
  24.       if {[catch {http::geturl $theurl -headers $hdr -query $body} result]} {
  25.         ## VV - PENDIENTE MODIFICAR ERRORES
  26.         if {[string first "couldn't open socket" $result] > -1} {
  27.                             puts "ERRORINFO:\nPlease check that the server is\
  28.                                                 connected to the internet or Loopback server is running. Error message: $result"
  29.                          
  30.         } else {
  31.             puts "ERRORINFO:\nThere's an unknown error with Loopback. Error message: $result"
  32.         }
  33.       } else {
  34.         set responseBody [http::data $result]
  35.         set responseStatus [::http::status $result]
  36.         set responseCode [::http::code $result]
  37.        
  38.         if {$responseStatus ne "ok"} {
  39.             # TO-DO: auditing table to store the notifications with errors.
  40.             puts "ERRORINFO:\nThere's an issue with the Loopback's response, please review. Error status $responseStatus"
  41.         }
  42.  
  43.         puts "---------------------- $responseBody"
  44.  
  45.         http::cleanup $result
  46.       }
  47. }
  48.  
  49. PONER LO SIGUIENTE EN EL ENCABEZADO DEL PROC
  50.  
  51. package require http 2.0;
  52. package require tls;
  53. ::http::register https 443 ::tls::socket
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement