���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/vidoe.top/proxy/logs/curl/examples/ |
<?php require __DIR__ . '/vendor/autoload.php'; use \Curl\Curl; const CLIENT_ID = 'XXXXXXXXXXXX.apps.googleusercontent.com'; const CLIENT_SECRET = 'XXXXXXXXXXXXXXXXXXXXXXXX'; session_start(); if (isset($_GET['code'])) { $code = $_GET['code']; // Exchange the authorization code for an access token. $curl = new Curl(); $curl->post('https://accounts.google.com/o/oauth2/token', array( 'code' => $code, 'client_id' => CLIENT_ID, 'client_secret' => CLIENT_SECRET, 'redirect_uri' => implode('', array( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http', '://', $_SERVER['SERVER_NAME'], $_SERVER['SCRIPT_NAME'], )), 'grant_type' => 'authorization_code', )); if ($curl->error) { echo $curl->response->error . ': ' . $curl->response->error_description; exit; } $_SESSION['access_token'] = $curl->response->access_token; header('Location: ?'); } elseif (!empty($_SESSION['access_token']) && !isset($_GET['retry'])) { // Use the access token to retrieve the profile. $curl = new Curl(); $curl->setHeader('Content-Type', 'application/json'); $curl->setHeader('Authorization', 'OAuth ' . $_SESSION['access_token']); $curl->get('https://www.googleapis.com/plus/v1/people/me'); if ($curl->error) { echo 'Error ' . $curl->response->error->code . ': ' . $curl->response->error->message . '.<br />'; echo '<a href="?retry">Retry?</a>'; exit; } echo 'Hi ' . $curl->response->displayName . '.'; } else { $curl = new Curl(); $curl->get('https://accounts.google.com/o/oauth2/auth', array( 'scope' => 'https://www.googleapis.com/auth/plus.me', 'redirect_uri' => implode('', array( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http', '://', $_SERVER['SERVER_NAME'], $_SERVER['SCRIPT_NAME'], )), 'response_type' => 'code', 'client_id' => CLIENT_ID, 'approval_prompt' => 'force', )); $url = $curl->responseHeaders['Location']; echo '<a href="' . $url . '">Continue</a>'; }