Send a OPTIONS request to a URL
@param string $url URL to send the OPTIONS request to
@param array $headers additional headers to send
@param mixed $parameters parameters to send in the querystring
@return \Ws\Http\Response
492451
public function options($url, $headers = [], $parameters = null)
    {
        return $this->send(Method::OPTIONS, $url, $parameters, $headers);
    }
954407
public static function get(string $url, array $params = null, array $headers = null)
    {
        return static::quickRequest($url, self::GET, $params, $headers);
    }
44254
public function put($url, array $data = [], array $headers = [])
    {
        $this->unsetOptions([CURLOPT_HTTPGET, CURLOPT_POST]);

        $this->setOption(CURLOPT_CUSTOMREQUEST, 'PUT');

        return $this->send($url, $data, $headers);
    }
993676
public function get($url, array $params = [], array $headers = [])
    {
        $url = $this->formatUrl($url, $url !== 'current/Me', $url == $this->nextUrl);

        try {
            $request = $this->createRequest('GET', $url, null, $params, $headers);
            $response = $this->client()->send($request);

            return $this->parseResponse($response, $url != $this->nextUrl);
        } catch (Exception $e) {
            $this->parseExceptionForErrorMessages($e);
        }
    }
707408
public function get($url, array $headers = array())
    {
        curl_setopt($this->handle, CURLOPT_HTTPGET, true);

        return $this->execute($url, $headers);
    }
1120115
protected function getUrl($url, $headers, $timeout): ResponseInterface
    {
        try {
            $options = $this->buildGuzzleOptions($headers, $timeout);
            $response = $this->requestFactory->request($url, 'GET', $options);
        } catch (ClientException $e) {
            $response = $e->getResponse();
        } catch (ServerException $e) {
            $response = $e->getResponse();
        }

        return $response;
    }
117370
public function put($url, $params = array(), $options = array())
    {
        return $this->request($url, self::PUT, $params, $options);
    }
337527
protected function request($url, $parameters = array(), $request = false)
        {
            $this->lastRequest = $url;
            $this->lastRequestData = $parameters;
            $this->responseHeaders = array();

            $curl = curl_init($url);

            $curlOptions = array(
                CURLOPT_SSL_VERIFYPEER => false,
                CURLOPT_REFERER        => $url,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_HEADERFUNCTION => array($this, 'parseHeader'),
            );

            if (! empty($parameters) || ! empty($request)) {
                if (! empty($request)) {
                    $curlOptions[ CURLOPT_CUSTOMREQUEST ] = $request;
                    $parameters = http_build_query($parameters);
                } else {
                    $curlOptions[ CURLOPT_POST ] = true;
                }

                $curlOptions[ CURLOPT_POSTFIELDS ] = $parameters;
            }

            curl_setopt_array($curl, $curlOptions);

            $response = curl_exec($curl);
            $error    = curl_error($curl);

            $this->lastRequestInfo = curl_getinfo($curl);

            curl_close($curl);

            if (! empty($error)) {
                throw new \Exception($error);
            }

            return $this->parseResponse($response);
        }
470451
public function request($url, $method = 'GET', $headers = [], $body = null, $options = [])
    {
        if (false === is_array($options)) {
            $options = [];
        }

        $request = $this->getGuzzleClient()->createRequest($method, $url, $options);

        $request->addHeaders($headers);
        $request->setBody($body);

        $response = $this->getGuzzleClient()->send($request);

        return [
            'code'    => $response->getStatusCode(),
            'headers' => $response->getHeaders(),
            'body'    => (string)$response->getBody(),
        ];
    }
759884
public function request(
        $url,
        array $parameters = [],
        $method = SocialConnectClient::GET,
        array $headers = [],
        array $options = []
    ) {
        switch ($method) {
            case SocialConnectClient::GET:
                $response = $this->_client->get(
                    $url,
                    $parameters,
                    ['headers' => $headers]
                );
                break;
            case SocialConnectClient::POST:
                $response = $this->_client->post(
                    $url,
                    $parameters,
                    ['headers' => $headers]
                );
                break;
            case SocialConnectClient::PUT:
                $response = $this->_client->put(
                    $url,
                    $parameters,
                    ['headers' => $headers]
                );
                break;
            case SocialConnectClient::DELETE:
                $response = $this->_client->delete(
                    $url,
                    $parameters,
                    ['headers' => $headers]
                );
                break;
            default:
                throw new InvalidArgumentException("Method {$method} is not supported");
        }

        return new Response(
            $response->getStatusCode(),
            (string)$response->getBody(),
            $response->getHeaders()
        );
    }
371297
private function buildRequest($url, array $headers = []): RequestInterface
    {
        $request = $this->requestFactory->createRequest('GET', $url);
        foreach ($headers as $header => $value) {
            $request = $request->withHeader($header, $value);
        }

        return $request;
    }
1088227
public function head($url, $headers = [], $options = [])
    {
        return $this->createRequestShortcut('HEAD', $url, null, $headers, $options);
    }
1312516
public function post($url, $body = [], $headers = [], $options = [])
    {
        return $this->request('POST', $url, $body, $headers, $options);
    }
1319214
private function sendRequest($url, $params, $post = 1, $headers = array('Accept: application/json, text/javascript, */*; q=0.01', 'Content-Type=application/x-www-form-urlencoded'))
	{
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		if (null !== $params)
			curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params, null, '&'));
		curl_setopt($ch, CURLOPT_POST, $post);
		curl_setopt($ch, CURLOPT_HEADER, 1);
		if (isset($this->token))
		{
			$headers[] = 'Authorization: '.$this->token;
		}
		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
		curl_setopt($ch, CURLOPT_VERBOSE, 0);
		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
		curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
		curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cacheFolder."/cookies.txt");
		curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cacheFolder."/cookies.txt");
		// Fake user agent to simulate a real browser
		curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/41.0.2272.76 Chrome/41.0.2272.76 Safari/537.36");
		curl_setopt($ch, CURLOPT_REFERER, $this->baseUrl);
		$response = curl_exec($ch);

		$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
		$header      = substr($response, 0, $header_size);
		$body        = substr($response, $header_size);
		$last_url    = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
		$info        = curl_getinfo($ch);

		curl_close($ch);

		return array('body' => $body, 'header' => $header, 'url' => $last_url);
	}
1182904
public function delete($url, array $options = [])
    {
        if ($token = $this->fetch('token')) {
            $this->bearer($token);
        }

        if (array_key_exists('delete', $this->methodHeaders)) {
            $this->addHeader('Content-Type', $this->methodHeaders['delete']['content_type']);
            $this->addHeader('Accept', $this->methodHeaders['delete']['accept']);
        }

        try {
            $response = $this->request->delete(sprintf('%s?%s', $this->getRealUrl($url, 'delete'), http_build_query(array_merge([$this->paramKey => $this->apiKey], $options))), [
                'headers' => $this->headers,
            ]);
        } catch (RequestException $e) {
            $response = $e->getResponse();
        }

        return $this->convertToSymfonyResponse($response);
    }
248729
public function get($url, $params = [], $options = [], $headers = []) {
        return $this->makeCall('get', $url, $params, $options, $headers);
    }
799008
public function head($url, $body = [], $headers = [], $options = [])
    {
        return $this->request('HEAD', $url, $body, $headers, $options);
    }