xxx - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of xxx.php

  1. <?php
  2. class SCB
  3. {
  4.     private $accountNo;
  5.     private $pin;
  6.     private $phone;
  7.     private $deviceId;
  8.     private $encrypt;
  9.     private $tilesVersion = "54";
  10.     private $useragent = "Android/9;FastEasy/3.54.0/5742";
  11.     private $api_auth;
  12.  
  13.     public function __construct($deviceId, $accountNo, $phone, $pin, $encrypt = NULL)
  14.     {
  15.         $this->deviceId = $deviceId;
  16.         $this->accountNo = $accountNo;
  17.         $this->pin = $pin;
  18.         $this->phone = $phone;
  19.         if ($encrypt !== NULL) {
  20.             $this->encrypt = $encrypt;
  21.         } else {
  22.             $this->encrypt = "http://api.scb-easy.com:3000/pin/encrypt";
  23.         }
  24.     }
  25.  
  26.     public function login()
  27.     {
  28.         $header = [
  29.             'Accept-Language: th',
  30.             'scb-channel: APP',
  31.             'User-Agent: ' . $this->useragent,
  32.             'Content-Type: application/json; charset=UTF-8',
  33.             'Host: fasteasy.scbeasy.com:8443',
  34.             'Connection: Keep-Alive',
  35.             'Accept-Encoding: gzip',
  36.         ];
  37.         
  38.         $data = [
  39.             "tilesVersion" => $this->tilesVersion,
  40.             "mobileNo" => $this->phone,
  41.             "userMode" => "INDIVIDUAL",
  42.             "isLoadGeneralConsent" => "1",
  43.             "deviceId" => $this->deviceId,
  44.             "jailbreak" => "0"
  45.         ];
  46.  
  47.         $url = "https://fasteasy.scbeasy.com/v3/login/preloadandresumecheck";
  48.         $resp = $this->Curl("POST", $url, json_encode($data), $header, true);
  49.  
  50.         preg_match_all('/(?<=Api-Auth: ).+/', $resp, $Auth);
  51.       
  52.         $Auth = Arr::get($Auth, '0.0');
  53.         if (empty($Auth) || is_null($Auth) || !isset($Auth)) {
  54.             return $this->handleError("ไม่สามารถรับ Api-Auth ได้");
  55.         } else {
  56.             $header = [
  57.                 'Accept-Language: th',
  58.                 'scb-channel: app',
  59.                 'User-Agent: ' . $this->useragent,
  60.                 'Host: fasteasy.scbeasy.com:8443',
  61.                 'Connection: Keep-Alive',
  62.                 'Accept-Encoding: gzip',
  63.                 'Api-Auth: ' . $Auth,
  64.                 'Content-Type: application/json; charset=UTF-8'
  65.             ];
  66.             $data = [
  67.                 "loginModuleId" => "PseudoFE"
  68.             ];
  69.             $url = "https://fasteasy.scbeasy.com/isprint/soap/preAuth";
  70.             $resp = $this->Curl("POST", $url, json_encode($data), $header);
  71.  
  72.             $getData = json_decode($resp, true);
  73.             $pseudoOaepHashAlgo = $getData['e2ee']['pseudoOaepHashAlgo'];
  74.             $pseudoSid = $getData['e2ee']['pseudoSid'];
  75.             $pseudoRandom = $getData['e2ee']['pseudoRandom'];
  76.             $pseudoPubKey = $getData['e2ee']['pseudoPubKey'];
  77.  
  78.             $header = [
  79.                 'Content-Type: application/x-www-form-urlencoded'
  80.             ];
  81.             $data = "Sid=" . $pseudoSid . "&ServerRandom=" . $pseudoRandom . "&pubKey=" . $pseudoPubKey . "&pin=" . $this->pin . "&hashType=" . $pseudoOaepHashAlgo;
  82.             $url = $this->encrypt;
  83.             $pseudoPin = $this->Curl("POST", $url, $data, $header);
  84.  
  85.             $header = [
  86.                 'Accept-Language: th',
  87.                 'scb-channel: app',
  88.                 'user-agent: ' . $this->useragent,
  89.                 'Content-Type: application/json; charset=UTF-8',
  90.                 'Api-Auth: ' . $Auth,
  91.                 'Host: fasteasy.scbeasy.com:8443',
  92.                 'Connection: Keep-Alive',
  93.                 'Accept-Encoding: gzip'
  94.             ];
  95.             $data = [
  96.                 "pseudoPin" => $pseudoPin,
  97.                 "tilesVersion" => $this->tilesVersion,
  98.                 "pseudoSid" => $pseudoSid,
  99.                 "deviceId" => $this->deviceId
  100.             ];
  101.             $url = "https://fasteasy.scbeasy.com/v1/fasteasy-login";
  102.             $resp = $this->Curl("POST", $url, json_encode($data), $header, true);
  103.             preg_match_all('/(?<=Api-Auth: ).+/', $resp, $Auth);
  104.             $Auth = $Auth[0][0];
  105.             if (empty($Auth) || is_null($Auth) || !isset($Auth)) {
  106.                 return $this->handleError("ไม่สามารถรับ Api-Auth ขั้น 2 ได้");
  107.             } else {
  108.                 Storage::put('cookiescb/' . $this->accountNo . '_cookie.txt', trim($Auth . PHP_EOL));
  109.                 $this->api_auth = $Auth;
  110.                 return true;
  111.             }
  112.         }
  113.     }
  114.  
  115.     public function getQRData($data = null)
  116.     {
  117.         if (empty($data)) {
  118.             return $this->handleError("ไม่มีข้อมูล QRCode");
  119.         }
  120.         $header = [
  121.             'Accept-Language: th',
  122.             'scb-channel: app',
  123.             'User-Agent: ' . $this->useragent,
  124.             'Host: fasteasy.scbeasy.com:8443',
  125.             'Connection: Keep-Alive',
  126.             'Accept-Encoding: gzip',
  127.             'Api-Auth: ' . $this->api_auth,
  128.             'Content-Type: application/json; charset=UTF-8'
  129.         ];
  130.         $data = [
  131.             "tilesVersion" => $this->tilesVersion,
  132.             "barcode" => $data,
  133.         ];
  134.         $url = "https://fasteasy.scbeasy.com/v7/payments/bill/scan";
  135.         $resp = $this->Curl("POST", $url, json_encode($data), $header);
  136.         return $resp;
  137.     }
  138.  
  139.     private function Curl($method, $url, $data, $header = [], $check_header = false)
  140.     {
  141.         $curl = curl_init();
  142.         curl_setopt_array($curl, array(
  143.             CURLOPT_URL => $url,
  144.             CURLOPT_RETURNTRANSFER => true,
  145.             CURLOPT_ENCODING => '',
  146.             CURLOPT_MAXREDIRS => 10,
  147.             CURLOPT_TIMEOUT => 0,
  148.             CURLOPT_FOLLOWLOCATION => true,
  149.             CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  150.             CURLOPT_HEADER => $check_header,
  151.             CURLOPT_HTTPHEADER => $header,
  152.             CURLOPT_CUSTOMREQUEST => $method,
  153.             CURLOPT_POSTFIELDS => $data,
  154.         ));
  155.         $response = curl_exec($curl);
  156.         curl_close($curl);
  157.         return $response;
  158.     }
  159.  
  160.     private function handleError($error = "เกิดข้อผิดพลาด")
  161.     {
  162.         $handle = [
  163.             "status" => [
  164.                 "code" => "9999",
  165.                 "header" => "",
  166.                 "description" => $error
  167.             ],
  168.             "data" => []
  169.         ];
  170.         return json_encode($handle);
  171.     }
  172. }
  173. $scbeiei = new SCB(
  174.             "0b987317-589c-5bde-e76a-925c0efae919",
  175.             "4141114295",
  176.             "0871195956",
  177.             "131984");
  178. $scblog = $scbeiei->login();
  179. echo($scblog);
  180. ?>
File Description
  • xxx
  • PHP Code
  • 04 Sep-2022
  • 6.27 Kb
You can Share it: