Advertisement
michaelyuen

Untitled

Jul 2nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2.         if ( isset($_POST['envia']) && $_POST['envia'] == 'ok' ) {
  3.         $post = $_POST;
  4.                 $result = file_get_contents( 'https://www.google.com/recaptcha/api/siteverify', false, stream_context_create( array(
  5.                         'http' => array(
  6.                                 'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
  7.                                 'method'  => 'POST',
  8.                                 'content' => http_build_query( array(
  9.                                         'response' => $_POST['g-recaptcha-response'],
  10.                                         'secret' => 'secret_key'
  11.                                 ) ),
  12.                         ),
  13.                 ) ) );
  14.                 $result = json_decode($result);
  15.                 var_dump( $result->success );
  16.                 // if everything's okay use your $post
  17.         }
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement