Poker Fox - API
Poker Fox - API
Poker Fox - API
  • 🦊Poker Fox - Transfer Wallet API
  • 产品介绍
    • 市场概况
    • 产品特徵
    • 产品说明
    • 核心功能
  • 对接流程
  • 对接环境
  • 接口列表
    • 设置Header
    • 公共参数
    • 登入游戏
    • 上分
    • 下分
    • 用戶信息
    • 上下分状态
    • 投注记录
    • 玩家在线状态
    • 玩家投注明细
  • 相关对照表
    • 游戏列表
    • 語言参数对照表
    • 币種参数对照表
    • 国家地区参数对照列表
    • 非游戏消费类型
    • 代码状态說明
  • 程序范例
    • PHP
    • GO
Powered by GitBook
  1. 程序范例

PHP

Last updated 1 year ago


PHP范例程序下载

<?php

class CryptographyHelper
{
    const cipher = 'AES-256-CBC';

    /**
     * 加密 $text 需加密内容 $key Appid $v AppSecret
     * @param string $text
     * @param string $key
     * @param string $iv
     * @return string
     */
    public static function EncryptAES256(string $text, string $key, string $iv): string
    {
        $encrypt = openssl_encrypt($text, self::cipher, $key, OPENSSL_RAW_DATA, $iv);

        return base64_encode($encrypt);
    }

    /**
     * 解密  $text 需解密内容 $key Appid $v AppSecret
     * @param string $text
     * @param string $key
     * @param string $iv
     * @return string
     */
    public static function DecryptAES256(string $text, string $key, string $iv): string
    {
        $decodeText = base64_decode($text);

        return openssl_decrypt($decodeText, self::cipher, $key, OPENSSL_RAW_DATA, $iv);
    }
}
<?php

require_once "./vendor/autoload.php";

use GuzzleHttp\Client;


$time = 1648111171;
$key = '3b4db1e4202bde5a1b75dbd941defc38'; // app id
$iv = '20454ee618d4fb86'; // app secret


$b = [
    'Account' => 'egg_test_ip_004',
];
$m = '1021202311031';
$t = $time;


echo "================= DES Example =================\n";
$postData = compact('b', 'm', 't');
echo 'Original Data ' . PHP_EOL;
print_r($postData);

$postData['b'] = CryptographyHelper::EncryptAES256(json_encode($postData['b']), $key, $iv);
echo 'After encrypted ' . PHP_EOL;
print_r($postData);

//$postData['b'] = CryptographyHelper::DecryptAES256($postData['b'], $key, $iv);
//$postData['b'] = json_decode($postData['b'], true);
//echo 'After decrypted ' . PHP_EOL;
//print_r($postData);
echo "================= END DES Example =================\n";


echo "\n\n\n";
echo "================= Send Request =================\n";


$params = [
    'json' => $postData,
];
$config = [
    'headers' => [
        'Content-Type' => 'application/json',
        'lang' => 'en-US',
    ],
];
$client = new Client($config);
//
$response = $client->post("http://qa1.h5_open_api.nqsf9emow.com:27799/v1/epoker/account/info", $params);
$data = \GuzzleHttp\json_decode($response->getBody()->getContents(), true);
print_r($data);
echo "================= End Send Request =================\n";