<?php

namespace KeenIO\Http\Adaptor;

use Buzz\Browser;

/**
 * Class Buzz
 * @package KeenIO\Http\Adaptor
 */
final class Buzz implements AdaptorInterface
{

    private $apiKey;
    private $browser;

    /**
     * @param $apiKey
     * @param null $client
     */
    public function __construct($apiKey, $client = null)
    {
        $this->apiKey = $apiKey;

        if (!$client) {
            $client = new Browser();
        }

        $this->browser = $client;
    }

    /**
     * post to the KeenIO API
     *
     * @param $url
     * @param array $parameters
     * @return mixed
     */
    public function doPost($url, array $parameters)
    {
        $headers = array(
            'Authorization' => $this->apiKey,
            'Content-Type' => 'application/json'
        );

        $content = json_encode($parameters);

        $response = $this->browser->post($url, $headers, $content);

        return $response->getContent();
    }
}

<?php

namespace KeenIO\Http\Adaptor;

use Buzz\Browser;
use Buzz\Client\Curl;

/**
 * Class Buzz
 * @package KeenIO\Http\Adaptor
 */
final class Buzz implements AdaptorInterface
{

    private $apiKey;
    private $browser;

    /**
     * @param $apiKey
     * @param null $client
     */
    public function __construct($apiKey)
    {
        $this->apiKey = $apiKey;
        $this->browser = new Browser(new Curl());
    }

    /**
     * post to the KeenIO API
     *
     * @param $url
     * @param array $parameters
     * @return mixed
     */
    public function doPost($url, array $parameters)
    {
        $headers = array(
            'Authorization' => $this->apiKey,
            'Content-Type' => 'application/json'
        );

        $content = json_encode($parameters);

        $response = $this->browser->post($url, $headers, $content);

        return $response->getContent();
    }
}

Use curl instead of file_get_contents
Use curl instead of file_get_contents
