class Api {
// API URL
public $api_url = 'http://api.buylike.vip/v2/'; // API URL
public $api_key = ''; // API key
/**
*
* Add Order
*
*/
public function add_order($data) {
$post = array_merge(array('key' => $this->api_key, 'action' => 'add'), $data);
$result = $this->connect($post);
return json_decode($result);
}
/**
*
* Order status
*
*/
public function status($order_id) {
$result = $this->connect(array(
'key' => $this->api_key,
'action' => 'status',
'order' => $order_id
));
return json_decode($result);
}
/**
*
* All services
*
*/
public function services() {
$result = $this->connect(array(
'key' => $this->api_key,
'action' => 'services',
));
return json_decode($result);
}
/**
*
* Balance
*
*/
public function balance() {
$result = $this->connect(array(
'key' => $this->api_key,
'action' => 'balance',
));
return json_decode($result);
}
/**
*
* Connect to panel
*
*/
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, 'Buylike Api');
$result = curl_exec($ch);
if (curl_errno($ch) != 0 && empty($result)) {
$result = false;
}
curl_close($ch);
return $result;
}
}
// Examples
$api = new Api();
# return all services
$services = $api->services();
print_r($services);
# return user balance
//$balance = $api->balance();
//print_r($balance);
# order like
//$order = $api->add_order(array('service' => 1, 'link' => 'https://www.instagram.com/p/CKMBam3FbYB/', 'quantity' => 100));
//print_r($order);
//die();
# order follower
//$order = $api->add_order(array('service' => 2, 'link' => 'https://www.instagram.com/google', 'quantity' => 100));
//print_r($order);
//die();
# order view
//$order = $api->add_order(array('service' => 3, 'link' => 'https://www.instagram.com/p/CJbcsXOloEm/', 'quantity' => 100));
//print_r($order);
//die();
# order Custom Comments
//$order = $api->add_order(array('service' => 4, 'link' => 'https://www.instagram.com/p/CKMBam3FbYB/', 'comments' => "1st\n2nd\n3rd\n4thn5th"));
//print_r($order);
//die();
# return status, charge, remains, start count, order_id
//$status = $api->status('FABCDEFGH_1611166418');
//print_r($status);