$this->api_key, 'action' => 'add' ], $data); return json_decode($this->connect($post)); } /** Get single order status */ public function status($order_id) { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'status', 'order' => $order_id ])); } /** Get multiple orders status */ public function multiStatus($order_ids) { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'status', 'orders' => implode(',', (array)$order_ids) ]), true); } /** Get services list */ public function services() { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'services' ])); } /** Refill single order */ public function refill(int $orderId) { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'refill', 'order' => $orderId ])); } /** Refill multiple orders */ public function multiRefill(array $orderIds) { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'refill', 'orders' => implode(',', $orderIds) ]), true); } /** Refill status */ public function refillStatus(int $refillId) { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'refill_status', 'refill' => $refillId ])); } /** Multiple refill statuses */ public function multiRefillStatus(array $refillIds) { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'refill_status', 'refills' => implode(',', $refillIds) ]), true); } /** Cancel orders */ public function cancel(array $orderIds) { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'cancel', 'orders' => implode(',', $orderIds) ]), true); } /** Get balance */ public function balance() { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'balance' ])); } /** CURL connection */ private function connect($post) { $postFields = []; foreach ($post as $key => $value) { $postFields[] = $key . '=' . urlencode($value); } $ch = curl_init($this->api_url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => implode('&', $postFields), CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_FOLLOWLOCATION => true, CURLOPT_USERAGENT => 'LimonSMM API Client' ]); $result = curl_exec($ch); if (curl_errno($ch)) { return json_encode(['error' => curl_error($ch)]); } curl_close($ch); return $result; } } /* |-------------------------------------------------------------------------- | USAGE EXAMPLES |-------------------------------------------------------------------------- */ $api = new Api(); // Services $services = $api->services(); // Balance $balance = $api->balance(); // Add order $order = $api->order([ 'service' => 1, 'link' => 'https://instagram.com/username', 'quantity' => 100 ]); // Order status $status = $api->status($order->order ?? 0); // Multiple status $statuses = $api->multiStatus([1, 2, 3]); // Refill $refill = $api->refill(12345);