api_key = $api_key; } } /** * Send API Request via cURL */ private function connect($data) { $data['key'] = $this->api_key; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->api_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $result = curl_exec($ch); if (curl_errno($ch)) { $error = curl_error($ch); curl_close($ch); return json_encode(['error' => $error]); } curl_close($ch); return json_decode($result, true); } // 1. Get Service List public function services() { return $this->connect(['action' => 'services']); } // 2. Place New Order public function order($data) { $post = array_merge(['action' => 'add'], $data); return $this->connect($post); } // 3. Get Order Status public function status($order_id) { return $this->connect([ 'action' => 'status', 'order' => $order_id ]); } // 4. Get Account Balance public function balance() { return $this->connect(['action' => 'balance']); } } /* ============================================================================== USAGE EXAMPLES ============================================================================== */ $api = new FarhanSMMAPI('YOUR_API_KEY_HERE'); // Example 1: Fetch Balance $balance = $api->balance(); print_r($balance); // Example 2: Fetch Services $services = $api->services(); print_r($services); // Example 3: Place New Order /* $newOrder = $api->order([ 'service' => 1, 'link' => 'https://instagram.com/yourusername', 'quantity' => 1000 ]); print_r($newOrder); */ ?>