PHP Example


<?php

class FbIgLikes
{
    private $apiKey = '';

    public function __construct($apiKey)
    {
        $this->apiKey = $apiKey;
    }

    private function post($postFields)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "https://fbiglikes.com/api/v2");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
        $response = curl_exec($ch);
        if (curl_errno($ch)) {
            echo 'Error:' . curl_error($ch);
            curl_close($ch);
            return false;
        }
        curl_close($ch);
        return json_decode($response, true);
    }

    public function findOrder($postFields)
    {
        return $this->post(array_merge($postFields, ['key' => $this->apiKey, 'action' => 'status']));
    }

    public function createOrder($postFields)
    {
        return $this->post(array_merge($postFields, ['key' => $this->apiKey, 'action' => 'add']));
    }

    public function services()
    {
        return $this->post(['key' => $this->apiKey, 'action' => 'services']);
    }

    public function balance()
    {
        return $this->post(['key' => $this->apiKey, 'action' => 'balance']);
    }
}

// Demo
$apiKey = 'YOUR_API_KEY';
$fbIgLikes = new FbIgLikes($apiKey);

// Find Order Status
$orderId = 'YOUR_ORDER_ID';
$orderStatus = $fbIgLikes->findOrder(['order_id' => $orderId]);

// Create New Order
$newOrder = [
    'service' => 'SERVICE_ID',
    'link' => 'YOUR_LINK',
    'quantity' => 'QUANTITY',
    'runs' => 'RUNS', // Optional
    'interval' => 'INTERVAL' // Optional
];
$order = $fbIgLikes->createOrder($newOrder);

// Get Services
$services = $fbIgLikes->services();

// Get Balance
$balance = $fbIgLikes->balance();

?>