$guzzleClient = new \GuzzleHttp\Client([
'headers' => [
'Content-Type' => 'application/json'
]
]);
$data = $guzzleClient->post(
'https://github.com/login/oauth/access_token',
[
'json' => [
'refresh_token' => $user->github_refresh_token,
'grant_type' => 'refresh_token',
'client_id' => config('services.github.client_id'),
'client_secret' => config('services.github.client_secret'),
],
'http_errors' => false
]
);
public static function check2()
{
$url = 'https://www.google.com/recaptcha/api/siteverify';
$data = array(
'secret' => Ts_App::getConfig('recaptcha2_priv_key'),
'response' => Request::getVar('g-recaptcha-response')
);
$query = http_build_query($data);
$options = array(
'http' => array (
'header' => "Content-Type: application/x-www-form-urlencoded\r\n".
"Content-Length: " . strlen($query)."\r\n".
"User-Agent:MyAgent/1.0\r\n",
'method' => 'POST',
'content' => $query
)
);
$context = stream_context_create($options);
$verify = file_get_contents($url, false, $context);
$captcha_success = json_decode($verify);
if ($captcha_success->success==false) {
return false;
} else if ($captcha_success->success==true) {
return true;
}
return false;
}