QuickBooks/IPP/OAuth.php
public function sign($method, $url, $oauth_token = null, $oauth_token_secret = null, $params = array()) 
	{
		/*
		print('got in: [' . $method . '], ' . $url);
		print_r($params);
		print('<br /><br /><br />');
		*/
		
		if (!is_array($params))
		{
			$params = array();
		}
		
		$params = array_merge($params, array(
			'oauth_consumer_key' => $this->_oauth_consumer_key, 
			'oauth_signature_method' => $this->_signature, 
			'oauth_nonce' => $this->_nonce(), 
			'oauth_timestamp' => $this->_timestamp(), 
			'oauth_version' => $this->_version,
			));
		
		// Add in the tokens if they were passed in
		if ($oauth_token)
		{
			$params['oauth_token'] = $oauth_token;
		}
		
		if ($oauth_token_secret)
		{
			$params['oauth_secret'] = $oauth_token_secret;
		}
		
		// Generate the signature
		$signature_and_basestring = $this->_generateSignature($this->_signature, $method, $url, $params);
		
		$params['oauth_signature'] = $signature_and_basestring[1];
		
		/*
		print('<pre>');
		print('BASE STRING IS [' . $signature_and_basestring[0] . ']' . "\n\n");
		print('SIGNATURE IS: [' . $params['oauth_signature'] . ']');
		print('</pre>');
		*/
		
		$normalized = $this->_normalize($params);
		
		/*
		print('NORMALIZE 1 [' . $normalized . ']' . "\n");
		print('NORMZLIZE 2 [' . $this->_normalize2($params) . ']' . "\n");
		*/

		if (false !== ($pos = strpos($url, '?')))
		{
			$url = substr($url, 0, $pos);
		}
		
		$normalized_url = $url . '?' . $normalized;			// normalized URL

		return array (
			0 => $signature_and_basestring[0], 		// signature basestring
			1 => $signature_and_basestring[1],		// signature
			2 => $normalized_url, 
			3 => $this->_generateHeader($params, $normalized),	// header string
			);
	}
public function sign($method, $url, $oauth_token = null, $oauth_token_secret = null, $params = array()) 
	{
		/*
		print('got in: [' . $method . '], ' . $url);
		print_r($params);
		print('<br /><br /><br />');
		*/
		
		if (!is_array($params))
		{
			$params = array();
		}
		
		$params = array_merge($params, array(
			'oauth_consumer_key' => $this->_oauth_consumer_key, 
			'oauth_signature_method' => $this->_signature, 
			'oauth_nonce' => $this->_nonce(), 
			'oauth_timestamp' => $this->_timestamp(), 
			'oauth_version' => $this->_version,
			));
		
		// Add in the tokens if they were passed in
		if ($oauth_token)
		{
			$params['oauth_token'] = $oauth_token;
		}
		
		if ($oauth_token_secret)
		{
			$params['oauth_secret'] = $oauth_token_secret;
		}
		
		// Generate the signature
		$signature_and_basestring = $this->_generateSignature($this->_signature, $method, $url, $params);
		
		$params['oauth_signature'] = $signature_and_basestring[1];
		
		/*
		print('<pre>');
		print('BASE STRING IS [' . $signature_and_basestring[0] . ']' . "\n\n");
		print('SIGNATURE IS: [' . $params['oauth_signature'] . ']');
		print('</pre>');
		*/
		
		$normalized = $this->_normalize($params);
		
		/*
		print('NORMALIZE 1 [' . $normalized . ']' . "\n");
		print('NORMZLIZE 2 [' . $this->_normalize2($params) . ']' . "\n");
		*/

		if (false !== ($pos = strpos($url, '?')))
		{
			$url = substr($url, 0, $pos);
		}
		
		$normalized_url = $url . '?' . $normalized;			// normalized URL

		return array (
			0 => $signature_and_basestring[0], 		// signature basestring
			1 => $signature_and_basestring[1],		// signature
			2 => $normalized_url, 
			3 => $this->_generateHeader($params, $normalized),	// header string
			);
	}
Sign an OAuth request and return the signing data (auth string, URL, etc.)