api_key = $api_key; if ($api_url) $this->api_url = $api_url; } public function order($data) { $post = array_merge(['key' => $this->api_key, 'action' => 'add'], $data); return json_decode($this->connect($post)); } public function status($order_id) { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'status', 'order' => $order_id ])); } public function multiStatus($order_ids) { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'status', 'orders' => implode(",", (array)$order_ids) ])); } public function services() { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'services' ])); } public function balance() { return json_decode($this->connect([ 'key' => $this->api_key, 'action' => 'balance' ])); } private function connect($post) { $_post = []; if (is_array($post)) { foreach ($post as $name => $value) { $_post[] = $name . '=' . urlencode($value); } } $ch = curl_init($this->api_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); if (is_array($post)) { curl_setopt($ch, CURLOPT_POSTFIELDS, join("&", $_post)); } curl_setopt($ch, CURLOPT_USERAGENT, 'SocialBoost-Reseller-Client/2.0'); $result = curl_exec($ch); if (curl_errno($ch)) { return json_encode(['error' => curl_error($ch)]); } curl_close($ch); return $result; } } // ============================================================================== // USAGE EXAMPLES: // ============================================================================== // $api = new SocialBoostApi('YOUR_API_KEY_HERE'); // 1. Check Account Balance: // $balance = $api->balance(); // echo "Balance: " . $balance->balance . " " . $balance->currency . PHP_EOL; // 2. Fetch Available Services & Rates: // $services = $api->services(); // foreach ($services as $svc) { // echo "#{$svc->service} - {$svc->name} (Rate: KES {$svc->rate} per 1k)\n"; // } // 3. Place an Order: // $order = $api->order([ // 'service' => 10082, // Service ID from services list // 'link' => 'https://instagram.com/p/your_post_url', // 'quantity' => 100 // ]); // print_r($order); // Returns: { "status": "success", "order": 12345 } // 4. Check Order Status: // $status = $api->status(12345); // print_r($status); // Returns: { "order": 12345, "status": "Pending", "charge": "...", "currency": "KES" }