public function oauthRequest($url, $method, $parameters, $data = array(), $headers = array())
	{
		// Set the parameters.
		$defaults = array(
			'oauth_consumer_key'     => $this->getOption('consumer_key'),
			'oauth_signature_method' => 'HMAC-SHA1',
			'oauth_version'          => '1.0',
			'oauth_nonce'            => $this->generateNonce(),
			'oauth_timestamp'        => time(),
		);

		$parameters = array_merge($parameters, $defaults);

		// Do not encode multipart parameters. Do not include $data in the signature if $data is not array.
		if (isset($headers['Content-Type']) && strpos($headers['Content-Type'], 'multipart/form-data') !== false || !\is_array($data))
		{
			$oauthHeaders = $parameters;
		}
		else
		{
			// Use all parameters for the signature.
			$oauthHeaders = array_merge($parameters, $data);
		}

		// Sign the request.
		$oauthHeaders = $this->signRequest($url, $method, $oauthHeaders);

		// Get parameters for the Authorisation header.
		if (\is_array($data))
		{
			$oauthHeaders = array_diff_key($oauthHeaders, $data);
		}

		// Send the request.
		switch ($method)
		{
			case 'GET':
				$url      = $this->toUrl($url, $data);
				$response = $this->client->get($url, array('Authorization' => $this->createHeader($oauthHeaders)));

				break;

			case 'POST':
				$headers  = array_merge($headers, array('Authorization' => $this->createHeader($oauthHeaders)));
				$response = $this->client->post($url, $data, $headers);

				break;

			case 'PUT':
				$headers  = array_merge($headers, array('Authorization' => $this->createHeader($oauthHeaders)));
				$response = $this->client->put($url, $data, $headers);

				break;

			case 'DELETE':
				$headers  = array_merge($headers, array('Authorization' => $this->createHeader($oauthHeaders)));
				$response = $this->client->delete($url, $headers);

				break;
		}

		// Validate the response code.
		$this->validateResponse($url, $response);

		return $response;
	}
public function oauthRequest($url, $method, $parameters, $data = array(), $headers = array())
	{
		// Set the parameters.
		$defaults = array(
			'oauth_consumer_key'     => $this->getOption('consumer_key'),
			'oauth_signature_method' => 'HMAC-SHA1',
			'oauth_version'          => '1.0',
			'oauth_nonce'            => $this->generateNonce(),
			'oauth_timestamp'        => time(),
		);

		$parameters = array_merge($parameters, $defaults);

		// Do not encode multipart parameters. Do not include $data in the signature if $data is not array.
		if (isset($headers['Content-Type']) && strpos($headers['Content-Type'], 'multipart/form-data') !== false || !\is_array($data))
		{
			$oauthHeaders = $parameters;
		}
		else
		{
			// Use all parameters for the signature.
			$oauthHeaders = array_merge($parameters, $data);
		}

		// Sign the request.
		$oauthHeaders = $this->signRequest($url, $method, $oauthHeaders);

		// Get parameters for the Authorisation header.
		if (\is_array($data))
		{
			$oauthHeaders = array_diff_key($oauthHeaders, $data);
		}

		// Send the request.
		switch ($method)
		{
			case 'GET':
				$url      = $this->toUrl($url, $data);
				$response = $this->client->get($url, array('Authorization' => $this->createHeader($oauthHeaders)));

				break;

			case 'POST':
				$headers  = array_merge($headers, array('Authorization' => $this->createHeader($oauthHeaders)));
				$response = $this->client->post($url, $data, $headers);

				break;

			case 'PUT':
				$headers  = array_merge($headers, array('Authorization' => $this->createHeader($oauthHeaders)));
				$response = $this->client->put($url, $data, $headers);

				break;

			case 'DELETE':
				$headers  = array_merge($headers, array('Authorization' => $this->createHeader($oauthHeaders)));
				$response = $this->client->delete($url, $headers);

				break;
		}

		// Validate the response code.
		$this->validateResponse($url, $response);

		return $response;
	}
public function oauthRequest ( $ url , $ method , $ parameters , $ data = array ( ) , $ headers = array ( ) ) { // Set the parameters. $ defaults = array ( 'oauth_consumer_key' => $ this -> getOption ( 'consumer_key' ) , 'oauth_signature_method' => 'HMAC-SHA1' , 'oauth_version' => '1.0' , 'oauth_nonce' => $ this -> generateNonce ( ) , 'oauth_timestamp' => time ( ) , ) ; $ parameters = array_merge ( $ parameters , $ defaults ) ; // Do not encode multipart parameters. Do not include $data in the signature if $data is not array. if ( isset ( $ headers [ 'Content-Type' ] ) && strpos ( $ headers [ 'Content-Type' ] , 'multipart/form-data' ) !== false || ! \ is_array ( $ data ) ) { $ oauthHeaders = $ parameters ; } else { // Use all parameters for the signature. $ oauthHeaders = array_merge ( $ parameters , $ data ) ; } // Sign the request. $ oauthHeaders = $ this -> signRequest ( $ url , $ method , $ oauthHeaders ) ; // Get parameters for the Authorisation header. if ( \ is_array ( $ data ) ) { $ oauthHeaders = array_diff_key ( $ oauthHeaders , $ data ) ; } // Send the request. switch ( $ method ) { case 'GET' : $ url = $ this -> toUrl ( $ url , $ data ) ; $ response = $ this -> client -> get ( $ url , array ( 'Authorization' => $ this -> createHeader ( $ oauthHeaders ) ) ) ; break ; case 'POST' : $ headers = array_merge ( $ headers , array ( 'Authorization' => $ this -> createHeader ( $ oauthHeaders ) ) ) ; $ response = $ this -> client -> post ( $ url , $ data , $ headers ) ; break ; case 'PUT' : $ headers = array_merge ( $ headers , array ( 'Authorization' => $ this -> createHeader ( $ oauthHeaders ) ) ) ; $ response = $ this -> client -> put ( $ url , $ data , $ headers ) ; break ; case 'DELETE' : $ headers = array_merge ( $ headers , array ( 'Authorization' => $ this -> createHeader ( $ oauthHeaders ) ) ) ; $ response = $ this -> client -> delete ( $ url , $ headers ) ; break ; } // Validate the response code. $ this -> validateResponse ( $ url , $ response ) ; return $ response ; }
Method used to make an OAuth request.

@param   string  $url         The request URL.
@param   string  $method      The request method.
@param   array   $parameters  Array containing request parameters.
@param   mixed   $data        The POST request data.
@param   array   $headers     An array of name-value pairs to include in the header of the request

@return  object  The Response object.

@since   1.0
@throws  \DomainException
Method used to make an OAuth request .