<?php
    include '../../function/connect.php';
class zulhayker
{
    public $agen        = "kleFV7btif";
    public $signature   = "19863eb73d586eaa56448cba92a6508e";
    public $url_request = "https://apimax.site/API/Production/connection.do";

    public function Create($username)
    {
        $action = $this->url_request . "?cmd=create&agent_code=" . $this->agen . "&username=" . $username . "&signature=" . $this->signature;
        return $this->Connect($action);
    }

    public function GameList($provider)
    {
        $action = $this->url_request . "?cmd=gamelist&agent_code=" . $this->agen . "&provider_code=" . $provider . "&signature=" . $this->signature;
        return $this->Connect($action);
    }

    public function ProviderList()
    {
        $action = $this->url_request . "?cmd=providerlist&agent_code=" . $this->agen . "&signature=" . $this->signature;
        return $this->Connect($action);
    }

    public function OpenGame($username, $game_code)
    {
        $action = $this->url_request . "?cmd=launch&agent_code=" . $this->agen . "&username=" . $username . "&gameid=" . $game_code . "&signature=" . $this->signature;
        return $this->Connect($action);
    }

    public function Transaksi($username, $amount, $type)
    {
        $action = $this->url_request . "?cmd=transaksi&agent_code=" . $this->agen . "&username=" . $username . "&amount=" . $amount . "&type=" . $type . "&signature=" . $this->signature;
        return $this->Connect($action);
    }

    public function GetBalance($username)
    {
        $action = $this->url_request . "?cmd=getbalance&agent_code=" . $this->agen . "&username=" . $username . "&signature=" . $this->signature;
        return $this->Connect($action);
    }

    public function InfoAgent()
    {
        $action = $this->url_request . "?cmd=operator&agent_code=" . $this->agen . "&signature=" . $this->signature;
        return $this->Connect($action);
    }

    public function HistoryBet()
    {
        $action = $this->url_request . "?cmd=history&agent_code=" . $this->agen . "&signature=" . $this->signature;
        return $this->Connect($action);
    }

    private function Connect($url)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
        curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.47 Safari/537.36');
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

        $output = curl_exec($ch);
        curl_close($ch);

        return $output;
    }
}

$ZH = new zulhayker();