See https://dev.twitter.com/oauth/overview/creating-signatures

@param  string $method
@param  string $url
@param  array  $params

@return string
177191
protected function generateSignature($method, $url, array $params)
    {
        $concat = implode('&', array_map(function($name, $value){
            return sprintf('%s=%s', $name, $value);
        }, array_keys($params), $params));

        $concatenatedParams = rawurlencode($concat);

        // normalize url
        $urlParts = parse_url($url);
        $scheme   = strtolower($urlParts['scheme']);
        $host     = strtolower($urlParts['host']);
        $port     = isset($urlParts['port']) ? intval($urlParts['port']) : 0;
        $retval   = strtolower($scheme) . '://' . strtolower($host);

        if (!empty($port) && (($scheme === 'http' && $port != 80) || ($scheme === 'https' && $port != 443))) {
            $retval .= ":{$port}";
        }

        $retval .= $urlParts['path'];

        if (!empty($urlParts['query'])) {
            $retval .= "?{$urlParts['query']}";
        }

        $normalizedUrl = rawurlencode($retval);
        $signatureBaseString = "{$method}&{$normalizedUrl}&{$concatenatedParams}";
        # sign the signature string
        $key = rawurlencode($this->consumerSecret) . '&' . rawurlencode($this->oauthSecret);

        return base64_encode(hash_hmac('sha1', $signatureBaseString, $key, true));
    }
989541
private function request($url, $params = [], $method = 'GET')
    {
        // Set URL & Header
        curl_setopt($this->curl, CURLOPT_URL, $this->url . $url);
        curl_setopt($this->curl, CURLOPT_HTTPHEADER, array());

        //Add post vars
        if($method == 'POST')
        {
            curl_setopt($this->curl, CURLOPT_POST, count($params));
            curl_setopt($this->curl, CURLOPT_POSTFIELDS, $params);
        }

        //Get result
        $result = curl_exec($this->curl);
        if($result === false)
            throw new \Exception('CURL error: ' . curl_error($this->curl));

        // decode results
        $result = json_decode($result, true);

        if(!is_array($result) || json_last_error())
            throw new \Exception('JSON decode error');

        return $result;

    }
780771
public function sign($http_method, $url, $params, $secret) {
        $sig = array(
            strtoupper($http_method),
            preg_replace('/%7E/', '~', rawurlencode($url)),
            rawurlencode($this->get_signable_parameters($params)),
        );

        $base_string = implode('&', $sig);
        $sig = base64_encode(hash_hmac('sha1', $base_string, $secret, true));
        return $sig;
    }
1227020
public static function create($method, $url)
    {
        $method = strtoupper($method);


        $parts = parse_url($url);
        $path = self::getCorrectPath($parts['path']);

        $canonicalQuery = '';
        if (array_key_exists('query', $parts)) {
            $canonicalQuery = self::getCanonicalQuery($parts['query']);
        }

        $qshString = $method . '&' . $path . '&' . $canonicalQuery;
        $qsh = hash('sha256', $qshString);

        return $qsh;
    }
382228
private function createSignature($secret, $params)
    {
        $tokenData = $this->base64UriEncode(json_encode($params));

        $hash = $this->hash($secret.$tokenData);

        return $hash.'.'.$tokenData;
    }
883063
private function _parseUrl(string $method, array $params = [])
    {
        $params = [
                'module' => 'API',
                'method' => $method,
                'token_auth' => $this->_token,
                'idSite' => $this->_siteId,
                'period' => $this->_period,
                'format' => $this->_format,
                'language' => $this->_language,
                'filter_limit' => $this->_filter_limit
            ] + $params;

        foreach ($params as $key => $value) {
            $params[$key] = urlencode($value);
        }

        if (!empty($this->_rangeStart) && !empty($this->_rangeEnd)) {
            $params = $params + [
                    'date' => $this->_rangeStart . ',' . $this->_rangeEnd,
                ];
        } elseif (!empty($this->_date)) {
            $params = $params + [
                    'date' => $this->_date,
                ];
        } else {
            throw new InvalidArgumentException('Specify a date or a date range!');
        }

        $url = $this->_site;

        $i = 0;
        foreach ($params as $param => $val) {
            if (!empty($val)) {
                $i++;
                if ($i > 1) {
                    $url .= '&';
                } else {
                    $url .= '?';
                }

                if (is_array($val)) {
                    $val = implode(',', $val);
                }
                $url .= $param . '=' . $val;
            }
        }

        return $url;
    }
269447
public function generate($method, $url, array $data = [], array $headers = [], $basicAuthCredentials = '')
    {
        $signatureParts = [$method, $url];
        $signatureParts[] = http_build_query($data);
        $signatureParts[] = http_build_query($headers);
        $signatureParts[] = $basicAuthCredentials;

        return implode('|', $signatureParts);
    }
1268417
public function api($url, $method, array $params = [], array $headers = [])
    {
        try {
            return $this->sendRequest($method, $url, $params, $headers);
        } catch (\Exception $e) {
            sleep(2);
            return $this->sendRequest($method, $url, $params, $headers);
        }
    }
1286450
protected function getSignature($data, $method = "sha1", $params = [])
    {
        ksort($data);
        if (!function_exists($method)) return false;
        foreach ($data as $k => $v) array_push($params, "{$k}={$v}");
        return $method(join('&', $params));
    }
543205
public function oAuthRequest($url, $method, $parameters)
    {
        if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) {
            $url = self::API_ENTRY_POINT.$url;
        }

        $request = OAuth\Request::from_consumer_and_token($this->getConsumerKey(), $this->getCurrentOAuthToken(), $method, $url, $parameters);
        $request->sign_request($this->sha1_method, $this->getConsumerKey(), $this->getCurrentOAuthToken());
        switch ($method) {
            case 'GET':
                return $this->http($request->to_url(), 'GET');
            default:
                return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata());
        }
    }
980711
function getSignature(array $params, $method = null)
    {
        ksort($params);
        unset($params['sign']);
        unset($params['signature']);
        array_push($params, $this->secretKey);

        if ($method) {
            array_unshift($params, $method);
        }

        return hash('sha256', join('{up}', $params));
    }
870098
public function create($method, $params)
    {
        if (strtolower($method) == 'get') {
            $this->get = $params;
        } else {
            $this->post = $params;
        }
        return $this;
    }
763
public function commit($method, $url, $params = [], $options = [])
    {
        if (empty($this->connectionToken)) {
            $this->loginApplication();
        }

        $request = [
            'exceptions'      => false,
            'timeout'         => '80',
            'connect_timeout' => '30',
            'headers'         => [
                'Content-Type'  => 'application/json',
                'Accept'        => 'application/json',
                'Authorization' => 'Bearer '.$this->connectionToken,
            ],
        ];

        if (!empty($params)) {
            $request[$method === 'get' ? 'query' : 'json'] = $params;
        }

        $raw = $this->getHttpClient()->{$method}($url, $request);
        $statusCode = $raw->getStatusCode();

        $response = $statusCode == 200
            ? $this->parseResponse($raw->getBody())
            : $this->responseError($raw->getBody(), $statusCode);

        return $this->respond($response);
    }
1315682
public function commit($method, $url, $params = [], $options = [])
    {
        $request = [
            'exceptions'      => false,
            'timeout'         => '80',
            'connect_timeout' => '30',
            'headers'         => [
                'Content-Type'  => 'application/json',
                'User-Agent'    => 'MercadoPago PayMeBindings/'.$this->config['version'],
            ],
        ];

        if (!empty($params)) {
            $request[$method === 'get' ? 'query' : 'json'] = $params;
        }

        $oauthUrl = $this->buildUrlFromString('oauth/token');

        $authRawResponse = $this->getHttpClient()->post($oauthUrl, [
            'json' => [
                'client_id'     => $this->config['client_id'],
                'client_secret' => $this->config['client_secret'],
                'grant_type'    => 'client_credentials',
            ],
        ]);

        if (!$this->oauthToken) {
            $authResponse = $this->parseResponse($authRawResponse);

            $this->oauthToken = Arr::get($authResponse, 'access_token');
        }

        $authUrl = sprintf('%s?access_token=%s', $url, $this->oauthToken);

        $rawResponse = $this->getHttpClient()->{$method}($authUrl, $request);

        $response = $this->parseResponse($rawResponse);

        $response['isRedirect'] = Arr::get($options, 'isRedirect', false);
        $response['topic'] = Arr::get($options, 'topic');

        return $this->respond($response, $rawResponse->getStatusCode());
    }
409510
public function createCall($method, $params = array())
	{
		$params = array_values($params);

		if ($this->isAsync())
		{
			$output = "_gaq.push(['{$method}',";
			$output .= substr(json_encode($params), 1, -1);
			$output .= ']);';
		}
		else
		{
			$output = "pageTracker.{$method}(";
			$output .= substr(json_encode($params), 1, -1);
			$output .= ');';
		}

		return $output;
	}
12530
private function createSignature($url, $params) {
    $url = $url . '?' . http_build_query($params);

    return 'giantbomb-'.substr(sha1($url), 0, 7);
  }
248875
public function call($url, $method = 'GET', $params = [])
    {
        // Set call parameters
        $params = array_merge($this->params, is_array($params)? $params : []);

        // Setup parameters
        $content = '';
        $queryString = http_build_query($params);
        if ($method === 'GET') {
            $url = $url . '?' . $queryString;
        } else {
            $content = $queryString;
        }

        // Make call
        $result = @file_get_contents($url, false, stream_context_create([
            'http' => [
                'method'  => $method,
                'header'  => 'Content-type: application/x-www-form-urlencoded',
                'content' => $content
            ]
        ]));

        // Return result
        return $result;
    }