本文整理汇总了PHP中Tygh\Http类的典型用法代码示例。如果您正苦于以下问题:PHP Http类的具体用法?PHP Http怎么用?PHP Http使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Http类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendRequest
protected static function SendRequest($requestString, $testMode)
{
if ($testMode) {
$serverUrl = "https://testpayments.worldnettps.com/merchant/xmlpayment";
} else {
$serverUrl = "https://payments.worldnettps.com/merchant/xmlpayment";
}
Registry::set('log_cut_data', array('CARDTYPE', 'CARDNUMBER', 'CARDEXPIRY', 'CARDHOLDERNAME', 'CVV', 'ISSUENO'));
return Http::post($serverUrl, $requestString);
}
示例2: getOrderExtended
public function getOrderExtended($transaction_id)
{
$data = array('userName' => $this->_login, 'password' => $this->_password, 'orderId' => $transaction_id);
$this->_response = Http::post($this->_url . 'getOrderStatusExtended.do', $data);
$this->_response = json_decode($this->_response, true);
if (!empty($this->_response['errorCode'])) {
$this->_error_code = $this->_response['errorCode'];
$this->_error_text = $this->_response['errorMessage'];
}
return $this->_response;
}
示例3: getBill
public function getBill($order_transaction)
{
$url = $this->_url . $order_transaction;
$extra = array('headers' => $this->_headers, 'basic_auth' => array($this->_login, $this->_password));
$this->_response = Http::get($url, array(), $extra);
$this->_response = json_decode($this->_response, true);
if (!empty($this->_response['response']['result_code'])) {
$this->_error_code = $this->_response['response']['result_code'];
$this->_error_text = $this->_response['response']['description'];
}
return $this->_response['response'];
}
示例4: fn_settings_actions_addons_seo
/**
* Check if mod_rewrite is active and clean up templates cache
*/
function fn_settings_actions_addons_seo(&$new_value, $old_value)
{
if ($new_value == 'A') {
Http::get(Registry::get('config.http_location') . '/catalog.html?version');
$headers = Http::getHeaders();
if (strpos($headers, '200 OK') === false) {
$new_value = 'D';
fn_set_notification('W', __('warning'), __('warning_seo_urls_disabled'));
}
}
fn_clear_cache();
return true;
}
示例5: fn_google_anaylitics_send
function fn_google_anaylitics_send($account, $order_info, $refuse = false)
{
$url = 'http://www.google-analytics.com/collect';
$sign = $refuse == true ? '-' : '';
//Common data which should be sent with any request
$required_data = array('v' => '1', 'tid' => $account, 'cid' => md5($order_info['email']), 'ti' => $order_info['order_id'], 'cu' => $order_info['secondary_currency']);
$transaction = array('t' => 'transaction', 'tr' => $sign . $order_info['total'], 'ts' => $sign . $order_info['shipping_cost'], 'tt' => $sign . $order_info['tax_subtotal']);
$result = Http::get($url, fn_array_merge($required_data, $transaction));
foreach ($order_info['products'] as $item) {
$item = array('t' => 'item', 'in' => $item['product'], 'ip' => fn_format_price($item['subtotal'] / $item['amount']), 'iq' => $sign . $item['amount'], 'ic' => $item['product_code'], 'iv' => fn_ga_get_main_category($item['product_id'], $order_info['lang_code']));
$result = Http::get($url, fn_array_merge($required_data, $item));
}
}
示例6: request
public function request($path, $params = array())
{
$options = $this->options;
$url = strtr($options['url'], array(':protocol' => $options['protocol'], ':host' => $options['is_test_mode'] ? $options['test_host'] : $options['live_host'], '::port' => $options['is_test_mode'] ? ':' . $options['test_port'] : '', ':path' => trim($path, '/')));
fn_yandex_money_log_write(array('REQUEST', $url, $params, $options), 'ym_mws_requests.log');
$response = Http::post($url, $params, array('ssl_cert' => $options['sslcert'], 'ssl_key' => $options['sslkey']));
fn_yandex_money_log_write(array('RESPONSE', $response), 'ym_mws_requests.log');
$response = $this->decodeResponse($response);
if (empty($response) || !empty($response['error']) || !empty($response['status'])) {
throw new ExceptionMWS('Error occured!', $response['error'], $response['techMessage']);
}
return $response;
}
示例7: fn_pp_request
function fn_pp_request($data, $mode)
{
$_post = array();
if (!empty($data)) {
foreach ($data as $index => $value) {
$_post[] = $index . '[' . strlen($value) . ']=' . $value;
}
}
$_post = implode('&', $_post);
$url = 'https://' . ($mode == 'Y' ? 'pilot-payflowpro.paypal.com' : 'payflowpro.paypal.com');
$response = Http::post($url, $_post, array('headers' => array('Content-type: application/x-www-form-urlencoded', 'Connection: close')));
$result = fn_pp_get_result($response);
return $result;
}
示例8: render
/**
* Render PDF document from HTML code
* @param string $html HTML code
* @param string $filename filename to save PDF or name of attachment to download
* @param boolean $save saves to file if true, outputs if not
* @param array $params params to post along with request
* @return mixed true if document saved, false on failure or outputs document
*/
public static function render($html, $filename = '', $save = false, $params = array())
{
if (is_array($html)) {
$html = implode("<div style='page-break-before: always;'> </div>", $html);
}
if (self::_isLocalIP(gethostbyname($_SERVER['HTTP_HOST']))) {
$html = self::_convertImages($html);
}
$default_params = array('content' => $html, 'page_size' => 'A4');
$params = array_merge($default_params, $params);
$content = Http::post(self::_action('/pdf/render'), json_encode($params), array('headers' => array('Content-type: application/json', 'Accept: application/pdf'), 'binary_transfer' => true));
if (!empty($content)) {
return self::_output($content, $filename, $save);
}
return false;
}
示例9: fn_settings_actions_security_secure_admin
/**
* Check if secure connection is available
*/
function fn_settings_actions_security_secure_admin(&$new_value, $old_value)
{
if ($new_value !== 'N') {
$suffix = '';
if (fn_allowed_for('ULTIMATE')) {
$suffix = '&company_id=' . Registry::get('runtime.company_id');
}
$admin_url = fn_url('index.index?check_https=Y' . $suffix, 'A', 'https');
$content = Http::get($admin_url);
if (empty($content) || $content != 'OK') {
// Disable https
Settings::instance()->updateValue('secure_admin', 'N', 'Security');
$new_value = 'N';
fn_set_notification('W', __('warning'), __('warning_https_disabled'));
}
}
}
示例10: updateUaRules
public static function updateUaRules()
{
$update_needed = false;
if (!file_exists(TWIGMO_UA_RULES_FILE)) {
$update_needed = true;
} else {
$rules_serialized = fn_get_contents(TWIGMO_UA_RULES_FILE);
$md5_on_twigmo = Http::get(TWG_CHECK_UA_UPDATES);
if (md5($rules_serialized) != $md5_on_twigmo) {
$update_needed = true;
}
}
if (!$update_needed) {
return;
}
$rules_on_twigmo = Http::get(TWG_UA_RULES);
fn_twg_write_to_file(TWIGMO_UA_RULES_FILE, $rules_on_twigmo, false);
}
示例11: isModRewriteEnabled
/**
* Check if mod_rewrite is available
*
* @return bool true if available
*/
public function isModRewriteEnabled()
{
if (defined('PRODUCT_EDITION') && PRODUCT_EDITION == 'ULTIMATE') {
// IIS Web-Servers fix
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'], 1);
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '') {
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
}
$url = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('index.php', '', $_SERVER['REQUEST_URI']);
$url .= 'mod_rewrite';
Http::get($url);
$headers = Http::getHeaders();
if (strpos($headers, '200 OK') === false) {
return false;
}
}
return true;
}
示例12: fn_settings_actions_security_secure_admin
/**
* Check if secure connection is available
*/
function fn_settings_actions_security_secure_admin(&$new_value, $old_value)
{
if ($new_value !== 'N') {
$suffix = '';
if (fn_allowed_for('ULTIMATE')) {
$suffix = '&company_id=' . Registry::get('runtime.company_id');
}
$admin_url = fn_url('index.index?check_https=Y' . $suffix, 'A', 'https');
$content = Http::get($admin_url);
if (empty($content) || $content != 'OK') {
// Disable https
Settings::instance()->updateValue('secure_admin', 'N', 'Security');
$new_value = 'N';
$error = Http::getErrorFields();
$error_warning = __('warning_https_is_disabled', array('[href]' => Registry::get('config.resources.kb_https_failed_url')));
$error_warning .= fn_settings_actions_build_detailed_error_message($error);
fn_set_notification('W', __('warning'), $error_warning);
}
}
}
示例13: array
function fn_cp_check_state($new_value, $old_value, $name)
{
$store_ip = fn_get_ip();
$store_ip = $store_ip['host'];
$extra_fields = array();
$_REQUEST = array('addon_status' => $new_value, 'ver' => PRODUCT_VERSION, 'product_status' => PRODUCT_STATUS, 'product_build' => strtoupper(PRODUCT_BUILD), 'edition' => PRODUCT_EDITION, 'lang' => strtoupper(CART_LANGUAGE), 'store_uri' => fn_url('', 'C', 'http'), 'secure_store_uri' => fn_url('', 'C', 'https'), 'https_enabled' => Registry::get('settings.General.secure_checkout') == 'Y' || Registry::get('settings.General.secure_admin') == 'Y' || Registry::get('settings.General.secure_auth') == 'Y' ? 'Y' : 'N', 'admin_uri' => fn_url('', 'A', 'http'), 'store_host' => Registry::get('config.http_host'), 'store_ip' => $store_ip, 'addon' => $name, 'license' => Registry::get('addons.' . $name . '.licensekey'));
$request = json_encode($_REQUEST);
$check_host = "http://cart-power.com/index.php?dispatch=check_license.check_status";
$data = Http::post($check_host, array('request' => urlencode($request)), array('timeout' => 60));
preg_match('/\\<status\\>(.*)\\<\\/status\\>/u', $data, $result);
$_status = 'FALSE';
if (isset($result[1])) {
$_status = $result[1];
}
if ($_REQUEST['dispatch'] == 'addons.update_status' && $_status != 'TRUE') {
db_query("UPDATE ?:addons SET status = ?s WHERE addon = ?s", 'D', $name);
fn_set_notification('W', __('warning'), __('cp_your_license_is_not_valid'));
exit;
}
return true;
}
示例14: fn_eway_rapidapi_request
function fn_eway_rapidapi_request($point, $request, $processor_data, &$response, $post = true)
{
if ($processor_data['processor_params']['mode'] == 'test') {
$request_url = 'https://api.sandbox.ewaypayments.com/';
} else {
$request_url = 'https://api.ewaypayments.com/';
}
if ($post) {
$response = Http::post($request_url . $point, json_encode($request), array('basic_auth' => array($processor_data['processor_params']['username'], $processor_data['processor_params']['password']), 'headers' => array("Content-Type: application/json")));
} else {
$response = Http::get($request_url . $point, $request, array('basic_auth' => array($processor_data['processor_params']['username'], $processor_data['processor_params']['password'])));
}
$headers = preg_split("/[\\s]/", Http::getHeaders(), 4);
if ($headers[1] == '200') {
$response = json_decode($response);
return true;
} else {
$response = $headers[1] . ' ' . $headers[2];
return false;
}
}
示例15: fn_settings_actions_general_secure_auth
/**
* Check if secure connection is available
*/
function fn_settings_actions_general_secure_auth(&$new_value, $old_value)
{
if ($new_value == 'Y') {
if (!fn_allowed_for('ULTIMATE') || fn_allowed_for('ULTIMATE') && Registry::get('runtime.company_id')) {
$suffix = '';
if (fn_allowed_for('ULTIMATE')) {
$suffix = '&company_id=' . Registry::get('runtime.company_id');
}
$storefront_url = fn_url('index.index?check_https=Y' . $suffix, 'C', 'https');
$content = Http::get($storefront_url);
if (empty($content) || $content != 'OK') {
// Disable https
Settings::instance()->updateValue('secure_checkout', 'N', 'General');
Settings::instance()->updateValue('secure_admin', 'N', 'General');
Settings::instance()->updateValue('secure_auth', 'N', 'General');
$new_value = 'N';
fn_set_notification('W', __('warning'), __('warning_https_disabled'));
}
}
}
}