<commit_before><?php
/**
 * Created by IntelliJ IDEA.
 * User: Brandon
 * Date: 7/6/2016
 * Time: 3:39 PM
 */

$recaptcha_secret_key = '<KEY>';

$postdata = file_get_contents("php://input");
$request = json_decode($postdata, true);

$captcha = "";
if (isset($request['g-recaptcha-response']))
    $captcha = $request['g-recaptcha-response'];

if (!$captcha)
    die("not ok");

$opts = array('http' =>
    array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => null
    )
);

$context  = stream_context_create($opts);

// handling the captcha and checking if it's ok
$response = json_decode(file_get_contents("http://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret_key."&response=".$captcha."&remoteip=".$_SERVER["REMOTE_ADDR"], false, $context), true);

var_dump($response);

// if the captcha is cleared with google, send the mail and echo ok.
if ($response["success"] != false) {
    // send the actual mail
    //@mail($email_to, $subject, $finalMsg);

    // the echo goes back to the ajax, so the user can know if everything is ok
    echo "ok";
} else {
    echo "not ok";
}<commit_msg>https php debugging.<commit_after><?php
/**
 * Created by IntelliJ IDEA.
 * User: Brandon
 * Date: 7/6/2016
 * Time: 3:39 PM
 */

$recaptcha_secret_key = '<KEY>';

$postdata = file_get_contents("php://input");
$request = json_decode($postdata, true);

$captcha = "";
if (isset($request['g-recaptcha-response']))
    $captcha = $request['g-recaptcha-response'];

if (!$captcha)
    die("not ok");

$opts = array('https' =>
    array(
        'method'  => 'POST',
        //'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => ''
    )
);

$context  = stream_context_create($opts);

// handling the captcha and checking if it's ok
//$response = file_get_contents("http://www.google.com");

//var_dump($response);

$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret_key."&response=".$captcha."&remoteip=".$_SERVER["REMOTE_ADDR"], false, $context);

var_dump($response);

// if the captcha is cleared with google, send the mail and echo ok.
//if ($response["success"] != false) {
//    // send the actual mail
//    //@mail($email_to, $subject, $finalMsg);
//
//    // the echo goes back to the ajax, so the user can know if everything is ok
//    echo "ok";
//} else {
//    echo "not ok";
//}
{'fraction_non_alphanumeric': 0.18676410881039382, 'fraction_numerical': 0.007308160779537149, 'mean_word_length': 3.6755218216318783, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 5, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5971164', 'n_tokens_mistral': 866, 'n_tokens_neox': 831, 'n_words': 201}