├── README.md └── freefire.class.php /README.md: -------------------------------------------------------------------------------- 1 | # Class PHP Auto TopupFireFree 2 | - ระบบเติมเพชรในเกม FreeFire Auto ผ่าน บัตรการีน่า 3 | 4 | # Variable 5 | - $open_id //เลขไอดีในเกม FreeFire 6 | - $garena_card //เลขบัตรการีน่า (ราคาตาม Package ในเว็บ Termgame.com) 7 | 8 | # Example 9 | ```php 10 | Login($open_id)); 17 | print_r($ff->BuyDiamond($garena_card)); 18 | ?> 19 | 20 | # Readme 21 | - Api นี้ไม่ใช้ Official ! 22 | - Class ตัวนี้เเจกฟรีไม่ได้ต้องการเงินอย่างใด ! 23 | ``` 24 | -------------------------------------------------------------------------------- /freefire.class.php: -------------------------------------------------------------------------------- 1 | $value) { 10 | $headers[] = $key.": ".$value; 11 | } 12 | return $headers; 13 | } 14 | 15 | public function request($method, $url, $data = null, $headers = array()){ 16 | $ch = curl_init(); 17 | if(!is_null($data)){ 18 | curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($data) ? json_encode($data) : $data); 19 | if (is_array($data)) $headers = array_merge(array( 20 | "Accept" => "application/json", 21 | "Content-Type" => "application/json", 22 | ), $headers); 23 | } 24 | curl_setopt_array($ch, array( 25 | CURLOPT_URL => $url, 26 | CURLOPT_CUSTOMREQUEST => $method, 27 | CURLOPT_RETURNTRANSFER => true, 28 | CURLOPT_PROXY => false, 29 | CURLOPT_SSL_VERIFYPEER => false, 30 | CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36", 31 | CURLOPT_HTTPHEADER => $this->getHeaders($headers), 32 | )); 33 | $this->response = curl_exec($ch); 34 | $this->http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 35 | if ($result = json_decode($this->response, true)) { 36 | if (isset($result["data"])) $this->data = $result["data"]; 37 | return $result; 38 | } 39 | return $this->response; 40 | } 41 | 42 | public function Login($game_id = null){ 43 | if (is_null($game_id)) return false; 44 | $result = $this->request("POST", "https://termgame.com/api/auth/player_id_login", array( 45 | "app_id" => 100067, 46 | "login_id" => strval($game_id) 47 | )); 48 | $this->open_id = $result["open_id"]; 49 | return $result; 50 | } 51 | 52 | public function BuyDiamond($card = null){ 53 | if(is_null($this->open_id) || is_null($card)) return false; 54 | $result = $this->request("POST", "https://termgame.com/api/shop/pay/init?language=th®ion=IN.TH", array( 55 | "app_id" => 100067, 56 | "channel_data" => array( 57 | "card_password" => strval($card), 58 | "friend_username" => null 59 | ), 60 | "channel_id" => 207000, 61 | "open_id" => strval($this->open_id), 62 | "packed_role_id" => 0, 63 | "service" => "pc" 64 | )); 65 | 66 | return $result; 67 | } 68 | } --------------------------------------------------------------------------------