$this->api_key), $data); $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($post)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $result = curl_exec($ch); if (curl_errno($ch)) { return json_encode(array('error' => curl_error($ch))); } curl_close($ch); return json_decode($result, true); } /** * Place a new order */ public function order($data) { $post = array_merge(array('action' => 'add'), $data); return $this->connect($post); } /** * Check status of a single order */ public function status($order_id) { return $this->connect(array( 'action' => 'status', 'order' => $order_id )); } /** * Check status of multiple orders */ public function multiStatus($order_ids) { return $this->connect(array( 'action' => 'status', 'orders' => is_array($order_ids) ? implode(',', $order_ids) : $order_ids )); } /** * Get list of services */ public function services() { return $this->connect(array( 'action' => 'services' )); } /** * Check user balance */ public function balance() { return $this->connect(array( 'action' => 'balance' )); } /** * Request refill for an order */ public function refill($order_id) { return $this->connect(array( 'action' => 'refill', 'order' => $order_id )); } /** * Check refill status */ public function refillStatus($refill_id) { return $this->connect(array( 'action' => 'refill_status', 'refill' => $refill_id )); } } // ========================================================================= // USAGE EXAMPLES // ========================================================================= $api = new Api(); // 1. Get User Account Balance // $balance = $api->balance(); // print_r($balance); // 2. Get Services List // $services = $api->services(); // print_r($services); // 3. Place a New Order /* $order = $api->order(array( 'service' => 1, // Service ID 'link' => 'https://instagram.com/username', 'quantity' => 1000 )); print_r($order); */ // 4. Check Order Status // $status = $api->status(12345); // print_r($status); // 5. Request Refill // $refill = $api->refill(12345); // print_r($refill);