Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PROCEDIMIENTO
- =============
- ad_proc -public subsite::verifyRecaptcha {
- -token
- } {
- sdafsdf sdfsdf sdf
- } {
- # VV - PENDIENTE ELIMINAR CODIGO BASURA
- puts "##############################################"
- puts "##############################################"
- puts "##############################################"
- puts "##############################################"
- #set data [string map { á a é e í i ó o ú u ñ n Á A É E Í I Ó O Ú U Ñ N ü u Ü U } $data]
- set hdr {Accept application/json Content-Type application/json}
- set body "{\"secret\": \"<<<<<<<<<PONER SECRET TOKEN AQUI>>>>>>\",\"response\": \"$token\"}"
- set theurl "https://www.google.com/recaptcha/api/siteverify"
- #:43830
- # HTTP access
- #puts "body $body"
- if {[catch {http::geturl $theurl -headers $hdr -query $body} result]} {
- ## VV - PENDIENTE MODIFICAR ERRORES
- if {[string first "couldn't open socket" $result] > -1} {
- puts "ERRORINFO:\nPlease check that the server is\
- connected to the internet or Loopback server is running. Error message: $result"
- } else {
- puts "ERRORINFO:\nThere's an unknown error with Loopback. Error message: $result"
- }
- } else {
- set responseBody [http::data $result]
- set responseStatus [::http::status $result]
- set responseCode [::http::code $result]
- if {$responseStatus ne "ok"} {
- # TO-DO: auditing table to store the notifications with errors.
- puts "ERRORINFO:\nThere's an issue with the Loopback's response, please review. Error status $responseStatus"
- }
- puts "---------------------- $responseBody"
- http::cleanup $result
- }
- }
- PONER LO SIGUIENTE EN EL ENCABEZADO DEL PROC
- package require http 2.0;
- package require tls;
- ::http::register https 443 ::tls::socket
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement