本文整理汇总了PHP中transport::getResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP transport::getResponse方法的具体用法?PHP transport::getResponse怎么用?PHP transport::getResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transport
的用法示例。
在下文中一共展示了transport::getResponse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _doRegister
/**
* Register the new install with the LC API
*
* @access private
* @return string
*/
private function _doRegister($data)
{
global $lC_Database, $lC_Cache;
if (isset($data['activation_email']) && $data['activation_email'] != NULL) {
$storeEmail = $data['activation_email'];
} else {
$storeEmail = STORE_OWNER_EMAIL_ADDRESS;
}
if (isset($data['activation_serial']) && $data['activation_serial'] != NULL) {
$storeSerial = $data['activation_serial'];
} else {
$storeSerial = '';
}
// register the install with LC API
$registerArr = array('serial' => $storeSerial, 'storeName' => STORE_NAME, 'storeEmail' => $storeEmail, 'storeWWW' => HTTP_SERVER . DIR_WS_HTTP_CATALOG, 'storeSSL' => HTTPS_SERVER . DIR_WS_HTTPS_CATALOG, 'systemMetaData' => base64_encode(json_encode(lc_get_system_information())), 'serverMetaData' => isset($_SERVER) && is_array($_SERVER) ? base64_encode(json_encode($_SERVER)) : NULL, 'envMetaData' => isset($_ENV) && is_array($_ENV) ? base64_encode(json_encode($_ENV)) : NULL);
$checksum = hash('sha256', json_encode($registerArr));
$registerArr['checksum'] = $checksum;
$api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
$registerArr['ver'] = utility::getVersion();
$request_type = getRequestType();
$resultXML = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/register/install/', 'method' => 'post', 'parameters' => $registerArr, 'timeout' => 10));
$newInstallationID = preg_match("'<installationID[^>]*?>(.*?)</installationID>'i", $resultXML, $regs) == 1 ? $regs[1] : NULL;
$products = preg_match("'<products[^>]*?>(.*?)</products>'i", $resultXML, $regs) == 1 ? $regs[1] : NULL;
if (lC_Server_info_Admin::updateInstallID($newInstallationID)) {
return utility::arr2xml(array('error' => FALSE, 'installationID' => $newInstallationID, 'products' => $products));
} else {
return utility::arr2xml(array('error' => TRUE, 'message' => 'error processing the request'));
}
}
示例2: initialize
public function initialize()
{
global $lC_Product;
if (defined('MODULE_CONTENT_PRODUCT_ON_HOMEPAGE')) {
$lC_Product = new lC_Product(MODULE_CONTENT_PRODUCT_ON_HOMEPAGE);
$product_url = HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'products.php?' . $lC_Product->getKeyword();
$resultHTML = transport::getResponse(array('url' => $product_url, 'method' => 'get'));
$content = substr($resultHTML, strpos($resultHTML, '<!--content/products/info.php start'));
$this->_content = substr($content, strpos($content, '<!--content/products/info.php start'), strpos($content, 'content/products/info.php end-->') + 32);
}
}
示例3: apiCheck
public static function apiCheck()
{
$api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
$request_type = getRequestType();
$apiCheck = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ver=' . utility::getVersion() . '&ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'get', 'timeout' => 10));
$versions = utility::xml2arr($apiCheck);
$error = false;
if (count($versions) == 0) {
// there was an error with the api
$error = true;
$errorMsg = preg_match("'<title[^>]*?>.*?</title>'si", $versions, $regs);
$errorMsg = is_array($regs) ? strip_tags(end($regs)) : NULL;
if ($errorMsg == '') {
$errorMsg = 'Resource Unavailable at ' . $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ver=' . utility::getVersion() . '&ref=' . $_SERVER['SCRIPT_FILENAME'];
}
$error = true;
// log the error
self::log('Error: ' . $errorMsg);
}
if ($versions == null || $error) {
// set the error flag
return -1;
}
return 1;
}
示例4: _upsGetQuote
private function _upsGetQuote()
{
if (!isset($this->_upsActionCode)) {
$this->_upsActionCode = '4';
}
$request = join('&', array('accept_UPS_license_agreement=yes', '10_action=' . $this->_upsActionCode, '13_product=' . $this->_upsProductCode, '14_origCountry=' . $this->_upsOriginCountryCode, '15_origPostal=' . $this->_upsOriginPostalCode, '19_destPostal=' . $this->_upsDestPostalCode, '22_destCountry=' . $this->_upsDestCountryCode, '23_weight=' . $this->_upsPackageWeight, '47_rate_chart=' . $this->_upsRateCode, '48_container=' . $this->_upsContainerCode, '49_residential=' . $this->_upsResComCode));
$response = transport::getResponse(array('url' => 'http://www.ups.com/using/services/rave/qcostcgi.cgi?' . $request, 'method' => 'get'));
$body_array = explode("\n", $response);
$returnval = array();
$errorret = 'error';
// only return error if NO rates returned
$n = sizeof($body_array);
for ($i = 0; $i < $n; $i++) {
$result = explode('%', $body_array[$i]);
$errcode = substr($result[0], -1);
switch ($errcode) {
case 3:
if (is_array($returnval)) {
$returnval[] = array($result[1] => $result[8]);
}
break;
case 4:
if (is_array($returnval)) {
$returnval[] = array($result[1] => $result[8]);
}
break;
case 5:
$errorret = $result[1];
break;
case 6:
if (is_array($returnval)) {
$returnval[] = array($result[3] => $result[10]);
}
break;
}
}
if (empty($returnval)) {
$returnval = $errorret;
}
return $returnval;
}
示例5: getAvailablePackages
/**
* Get all available update packages
*
* @access public
* @return array
*/
public static function getAvailablePackages()
{
global $lC_Api;
$result = array('entries' => array());
$api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
$request_type = getRequestType();
$versions = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'get', 'timeout' => 10));
$versions_array = utility::xml2arr($versions);
$counter = 0;
foreach ($versions_array['data'] as $l => $v) {
if (version_compare(utility::getVersion(), $v['version'], '<')) {
$result['entries'][] = array('key' => $counter, 'version' => $v['version'], 'date' => lC_DateTime::getShort(lC_DateTime::fromUnixTimestamp(lC_DateTime::getTimestamp($v['dateCreated'], 'Ymd'))), 'announcement' => $v['newsLink'], 'update_package' => isset($v['pharLink']) ? $v['pharLink'] . '?ref=' . urlencode($_SERVER['SCRIPT_FILENAME']) : null);
$counter++;
}
}
@usort($result['entries'], function ($a, $b) {
return version_compare($a['version'], $b['version'], '>');
});
$result['total'] = count($result['entries']);
return $result;
}
示例6: getAddonPhar
public static function getAddonPhar($key, $type = 'addon')
{
// remove the old phar if it exists
if (file_exists(DIR_FS_WORK . 'addons/' . $key . '.phar')) {
unlink(DIR_FS_WORK . 'addons/' . $key . '.phar');
}
$api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
// add the pubkey
$pubkey = file_get_contents(DIR_FS_WORK . 'addons/update.phar.pubkey');
file_put_contents(DIR_FS_WORK . 'addons/' . $key . '.phar.pubkey', $pubkey);
$request_type = getRequestType();
$response = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/get/' . $key . '?type=addon&ver=' . utility::getVersion() . '&ref=' . urlencode($_SERVER['SCRIPT_FILENAME']), 'method' => 'get', 'timeout' => 10));
if (strlen($response) == 0) {
$response = file_get_contents($request_type . '://api.loadedcommerce.com/' . $api_version . '/get/' . $key . '?type=addon&ver=' . utility::getVersion() . '&ref=' . urlencode($_SERVER['SCRIPT_FILENAME']));
}
return file_put_contents(DIR_FS_WORK . 'addons/' . $key . '.phar', $response);
}