���� 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/trader/ |
<?php function rand43char(){ $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $characters_length = strlen($characters); $random_string = ''; for ($i = 0; $i < 43; $i++) { $random_string .= $characters[rand(0, $characters_length - 1)]; } return $random_string; } function base64_urlencode($str) { return rtrim(strtr(base64_encode($str), '+/', '-_'), '='); } $code_verifier = rand43char(); // First, convert the code verifier to ASCII $ascii_code_verifier = $code_verifier; /* for ($i = 0; $i < strlen($code_verifier); $i++) { $ascii_code_verifier .= ord($code_verifier[$i]); } */ // Next, hash the ASCII code verifier using SHA-256 algorithm $hashed_code_verifier = hash('sha256', $ascii_code_verifier, true); // Finally, encode the hashed code verifier using Base64 $base64_encoded = base64_urlencode($hashed_code_verifier); require 'vendor/autoload.php'; use Zalo\Zalo; $config = array( 'app_id' => '471498444723430652', 'app_secret' => 'T17WLNaKeWlRW8c8fXQ4' ); $zalo = new Zalo($config); $helper = $zalo -> getRedirectLoginHelper(); $callbackUrl = "https://trader.vidoe.top/zalo.php"; $state = $code_verifier; $codeChallenge = $base64_encoded; if(!isset($_GET['code']) or $_GET['code']!=''){ $loginUrl = $helper->getLoginUrl($callBackUrl, $codeChallenge, $state); header('Location: '.$loginUrl); }else{ $codeVerifier = $_GET['code']; $zaloToken = $helper->getZaloToken($codeVerifier); // get zalo token $accessToken = $zaloToken->getAccessToken(); $params = ['fields' => 'id,name,picture']; $response = $zalo->get(ZaloEndpoint::API_GRAPH_ME, $accessToken, $params); $result = $response->getDecodedBody(); // result print_r($result); exit(); } ?>