src/Messenger.php
public function api($url, $body = null, $type = self::TYPE_POST)
    {
        $body['access_token'] = $this->accessToken;

        $this->setBody($body);

        $headers = [
            'Content-Type: application/json',
        ];

        if ($type == self::TYPE_GET) {
            $url .= '?'.http_build_query($body);
        }

        $curl = curl_init($this->url . $url);

        if($type == self::TYPE_POST) {
            curl_setopt($curl, CURLOPT_POST, 1);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($body));
        }

        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

        $response = curl_exec($curl);
        curl_close($curl);

        return json_decode($response, true);
    }
public function api($url, $body = null, $type = self::TYPE_POST)
    {
        $body['access_token'] = $this->accessToken;

        $this->setBody($body);

        $headers = [
            'Content-Type: application/json',
        ];

        if ($type == self::TYPE_GET) {
            $url .= '?'.http_build_query($body);
        }

        $curl = curl_init($this->url . $url);

        if($type == self::TYPE_POST) {
            curl_setopt($curl, CURLOPT_POST, 1);
            curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($body));
        }

        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

        $response = curl_exec($curl);
        curl_close($curl);

        return json_decode($response, true);
    }
Request to Facebook API

@param string $url Url
@param array  $body Body
@param string $type Request type (POST)

@return array