本文整理汇总了PHP中QuickBooks_Utilities::GUID方法的典型用法代码示例。如果您正苦于以下问题:PHP QuickBooks_Utilities::GUID方法的具体用法?PHP QuickBooks_Utilities::GUID怎么用?PHP QuickBooks_Utilities::GUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuickBooks_Utilities
的用法示例。
在下文中一共展示了QuickBooks_Utilities::GUID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _http
protected function _http($Context, $url_path, $raw_body)
{
$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]);
$headers = array('Content-Type' => 'application/json', 'Request-Id' => QuickBooks_Utilities::GUID());
$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 {
$return = null;
// ERROR
}
}
$this->_last_request = $HTTP->lastRequest();
$this->_last_response = $HTTP->lastResponse();
//
$this->log($HTTP->getLog(), QUICKBOOKS_LOG_DEBUG);
$info = $HTTP->lastInfo();
print "Info: ";
print_r($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;
}