<?
    class API_GO
    {
        public $api_url = 'http://api.panel.social-marketing.ru/'; // API ссылка

        public $api_key = 'Your API key (Ваш API ключ)'; // Ваш API ключ

        public function order($services, $link, $count)
        {
            return json_decode($this->connect(array(
                'key' => $this->api_key,
                'method' => 'add',
                'service' => $services,
                'url' => $link,
                'count' => $count
            )), true);
        }

        public function services()
        {
            return json_decode($this->connect(array(
                'key' => $this->api_key,
                'method' => 'services'
            )), true);
        }

        public function balance()
        {
            return json_decode($this->connect(array(
                'key' => $this->api_key,
                'method' => 'balance'
            )), true);
        }

        public function status($order_id)
        {
            return json_decode($this->connect(array(
                'key' => $this->api_key,
                'method' => 'status',
                'order_id' => $order_id
            )), true);
        }


        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_GO();
    $services = $api->services(); # список всех услуг
    $balance  = $api->balance(); # баланс
    $orders  = $api->order('1', 'https://vk.com/id178326938', '5000'); # заказ услуги
    $status  = $api->status('2574'); # статус заказа
?>