$this->api_key, 'action' => 'add'), $data); return json_decode($this->connect($post)); } public function status($order_id) { return json_decode($this->connect(array( 'key' => $this->api_key, 'action' => 'status', 'order' => $order_id ))); } public function multiStatus($order_ids) { return json_decode($this->connect(array( 'key' => $this->api_key, 'action' => 'status', 'orders' => implode(",", (array)$order_ids) ))); } public function services() { return json_decode($this->connect(array( 'key' => $this->api_key, 'action' => 'services', ))); } public function balance() { return json_decode($this->connect(array( 'key' => $this->api_key, 'action' => 'balance', ))); } public function refill($order_id) { return json_decode($this->connect(array( 'key' => $this->api_key, 'action' => 'refill', 'order' => $order_id ))); } public function refillStatus($refill_id) { return json_decode($this->connect(array( 'key' => $this->api_key, 'action' => 'refill_status', 'refill' => $refill_id ))); } public function cancel($order_id) { return json_decode($this->connect(array( 'key' => $this->api_key, 'action' => 'cancel', 'order' => $order_id ))); } private function connect($post) { $_post = Array(); 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, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'); $result = curl_exec($ch); if (curl_errno($ch) != 0 && empty($result)) { $result = false; } curl_close($ch); return $result; } } $api = new Api(); $services = $api->services(); $balance = $api->balance(); $order = $api->order(array('service' => 1, 'link' => 'http://example.com/test', 'quantity' => 100)); $order = $api->order(array('service' => 2, 'link' => 'http://example.com/test')); $order = $api->order(array('service' => 3, 'link' => 'http://example.com/test', 'comments' => "good pic\ngreat photo\n:)\n;)"))); $order = $api->order(array('service' => 4, 'link' => 'http://example.com/test', 'quantity' => 100, 'mentions_hashtags' => "#goodphoto\n#amazing\n#love")); $order = $api->order(array('service' => 5, 'link' => 'http://example.com/test', 'quantity' => 100, 'mentions_custom' => "test\nexample\nfb")); $order = $api->order(array('service' => 6, 'link' => 'http://example.com/test', 'quantity' => 1000, 'mentions' => "50")); $order = $api->order(array('service' => 7, 'link' => 'http://example.com/test', 'quantity' => 100, 'answer_number' => '7')); $order = $api->order(array('service' => 11, 'username' => 'username', 'min' => 100, 'max' => 110, 'posts' => 0, 'delay' => 30, 'expiry' => '11/11/2019')); $order = $api->order(array('service' => 1, 'link' => 'http://example.com/test', 'quantity' => 100, 'runs' => 10, 'interval' => 60)); $status = $api->status($order->order); $statuses = $api->multiStatus([1, 2, 3]); $refill = $api->refill(12345); $refillStatus = $api->refillStatus(12345); $cancel = $api->cancel(12345);