true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($params), CURLOPT_TIMEOUT => 60, ]); $body = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return ['http_code' => $code, 'body' => json_decode($body, true) ?? $body]; } function trixbay_request(string $method, string $url, string $apiKey, ?array $json = null): array { $headers = [ 'Accept: application/json', 'X-Api-Key: ' . $apiKey, ]; $ch = curl_init($url); $opts = [ CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => strtoupper($method), CURLOPT_HTTPHEADER => $headers, CURLOPT_TIMEOUT => 60, ]; if ($json !== null) { $headers[] = 'Content-Type: application/json'; $opts[CURLOPT_HTTPHEADER] = $headers; $opts[CURLOPT_POSTFIELDS] = json_encode($json); } curl_setopt_array($ch, $opts); $body = curl_exec($ch); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return ['http_code' => $code, 'body' => json_decode($body, true) ?? $body]; } // --------------------------------------------------------------------------- // 1) SMM — PerfectPanel style (POST /api/v1) // --------------------------------------------------------------------------- // Balance print_r(trixbay_post_form($base, [ 'key' => $apiKey, 'action' => 'balance', ])); // Service list print_r(trixbay_post_form($base, [ 'key' => $apiKey, 'action' => 'services', ])); // Place order print_r(trixbay_post_form($base, [ 'key' => $apiKey, 'action' => 'add', 'service' => 1, 'link' => 'https://example.com/page', 'quantity' => 1000, ])); // Order status print_r(trixbay_post_form($base, [ 'key' => $apiKey, 'action' => 'status', 'order' => 1242, ])); // Refill print_r(trixbay_post_form($base, [ 'key' => $apiKey, 'action' => 'refill', 'order' => 1242, ])); // Refill status print_r(trixbay_post_form($base, [ 'key' => $apiKey, 'action' => 'refill_status', 'refill' => 12345, ])); // --------------------------------------------------------------------------- // 2) REST wallet balance // --------------------------------------------------------------------------- print_r(trixbay_request('GET', $base . '/balance', $apiKey)); // --------------------------------------------------------------------------- // 3) Buy Accounts // --------------------------------------------------------------------------- print_r(trixbay_request('GET', $base . '/buy-accounts/services', $apiKey)); print_r(trixbay_request('GET', $base . '/buy-accounts/services/1/stocks', $apiKey)); print_r(trixbay_request('POST', $base . '/buy-accounts/purchase', $apiKey, [ 'stock_id' => 1, 'quantity' => 1, ])); print_r(trixbay_request('GET', $base . '/buy-accounts/orders', $apiKey)); print_r(trixbay_request('GET', $base . '/buy-accounts/orders/12', $apiKey)); // --------------------------------------------------------------------------- // 4) Virtual Numbers // --------------------------------------------------------------------------- // Catalog is public (key optional) print_r(trixbay_request('GET', $base . '/virtual-numbers/countries', $apiKey)); print_r(trixbay_request('GET', $base . '/virtual-numbers/services', $apiKey)); print_r(trixbay_request('GET', $base . '/virtual-numbers/pricing?country=12&service=tg', $apiKey)); print_r(trixbay_request('POST', $base . '/virtual-numbers/purchase/activation', $apiKey, [ 'country' => '12', 'service' => 'tg', ])); print_r(trixbay_request('GET', $base . '/virtual-numbers/orders', $apiKey)); print_r(trixbay_request('POST', $base . '/virtual-numbers/orders/1/check', $apiKey)); // --------------------------------------------------------------------------- // 5) VTU // --------------------------------------------------------------------------- print_r(trixbay_request('GET', $base . '/vtu/variations/data?service_id=mtn', $apiKey)); print_r(trixbay_request('POST', $base . '/vtu/purchase/airtime', $apiKey, [ 'phone' => '08012345678', 'service_id' => 'mtn', 'amount' => 1000, ])); print_r(trixbay_request('POST', $base . '/vtu/purchase/data', $apiKey, [ 'phone' => '08012345678', 'service_id' => 'mtn', 'variation_id' => 'mtn-1gb-30days', ])); print_r(trixbay_request('GET', $base . '/vtu/orders', $apiKey));