QuickBooks/Payments.php
protected function _http($Context, $url_path, $raw_body = null, $operation = null)
	{
		if($operation !== null)
		{
			$method = $operation;
		}
		else
		{
			$method = 'GET';
			if ($raw_body)
			{
				$method = 'POST';
			}
		}

		$url = $this->_getBaseURL() . $url_path;

		$authcreds = $Context->authcreds();

		$params = array();

		$OAuth = new QuickBooks_IPP_OAuth($this->_oauth_consumer_key, $this->_oauth_consumer_secret);
		$signed = $OAuth->sign($method, $url, $authcreds['oauth_access_token'], $authcreds['oauth_access_token_secret'], $params);

		//print_r($signed);

		//$HTTP = new QuickBooks_HTTP($signed[2]);

		$HTTP = new QuickBooks_HTTP($url);

		$headers = array(
			'Content-Type' => 'application/json',
			'Request-Id' => QuickBooks_Utilities::GUID(),
			'Authorization' => $signed[3],
			);
		$HTTP->setHeaders($headers);

		// Turn on debugging for the HTTP object if it's been enabled in the payment processor
		$HTTP->useDebugMode($this->_debug);

		//
		$HTTP->setRawBody($raw_body);

		$HTTP->verifyHost(false);
		$HTTP->verifyPeer(false);

		if ($method == 'POST')
		{
			$return = $HTTP->POST();
		}
		else if ($method == 'GET')
		{
			$return = $HTTP->GET();
		}
		else if ($method == 'DELETE')
		{
			$return = $HTTP->DELETE();
		}
		else
		{
			$return = null;  // ERROR
		}

		$this->_last_request = $HTTP->lastRequest();
		$this->_last_response = $HTTP->lastResponse();

		//
		$this->log($HTTP->getLog(), QUICKBOOKS_LOG_DEBUG);

		$info = $HTTP->lastInfo();
		$this->_last_httpinfo = $info;

		$errnum = $HTTP->errorNumber();
		$errmsg = $HTTP->errorMessage();

		if ($errnum)
		{
			// An error occurred!
			$this->_setError(QuickBooks_Payments::ERROR_HTTP, $errnum . ': ' . $errmsg);
			return false;
		}

		if ($info['http_code'] == 401)
		{
			$this->_setError(QuickBooks_Payments::ERROR_AUTH, 'Payments return a 401 Unauthorized status.');
			return false;
		}

		// Everything is good, return the data!
		$this->_setError(QuickBooks_Payments::ERROR_OK, '');
		return $return;
	}
protected function _http($Context, $url_path, $raw_body = null, $operation = null)
	{
		if($operation !== null)
		{
			$method = $operation;
		}
		else
		{
			$method = 'GET';
			if ($raw_body)
			{
				$method = 'POST';
			}
		}

		$url = $this->_getBaseURL() . $url_path;

		$authcreds = $Context->authcreds();

		$params = array();

		$OAuth = new QuickBooks_IPP_OAuth($this->_oauth_consumer_key, $this->_oauth_consumer_secret);
		$signed = $OAuth->sign($method, $url, $authcreds['oauth_access_token'], $authcreds['oauth_access_token_secret'], $params);

		//print_r($signed);

		//$HTTP = new QuickBooks_HTTP($signed[2]);

		$HTTP = new QuickBooks_HTTP($url);

		$headers = array(
			'Content-Type' => 'application/json',
			'Request-Id' => QuickBooks_Utilities::GUID(),
			'Authorization' => $signed[3],
			);
		$HTTP->setHeaders($headers);

		// Turn on debugging for the HTTP object if it's been enabled in the payment processor
		$HTTP->useDebugMode($this->_debug);

		//
		$HTTP->setRawBody($raw_body);

		$HTTP->verifyHost(false);
		$HTTP->verifyPeer(false);

		if ($method == 'POST')
		{
			$return = $HTTP->POST();
		}
		else if ($method == 'GET')
		{
			$return = $HTTP->GET();
		}
		else if ($method == 'DELETE')
		{
			$return = $HTTP->DELETE();
		}
		else
		{
			$return = null;  // ERROR
		}

		$this->_last_request = $HTTP->lastRequest();
		$this->_last_response = $HTTP->lastResponse();

		//
		$this->log($HTTP->getLog(), QUICKBOOKS_LOG_DEBUG);

		$info = $HTTP->lastInfo();
		$this->_last_httpinfo = $info;

		$errnum = $HTTP->errorNumber();
		$errmsg = $HTTP->errorMessage();

		if ($errnum)
		{
			// An error occurred!
			$this->_setError(QuickBooks_Payments::ERROR_HTTP, $errnum . ': ' . $errmsg);
			return false;
		}

		if ($info['http_code'] == 401)
		{
			$this->_setError(QuickBooks_Payments::ERROR_AUTH, 'Payments return a 401 Unauthorized status.');
			return false;
		}

		// Everything is good, return the data!
		$this->_setError(QuickBooks_Payments::ERROR_OK, '');
		return $return;
	}
Perform a Quickbooks Payments operation via HTTP

@param  $Context
@param  $url_path
@param  $raw_body
@param  $operation
@return boolean