本文整理汇总了PHP中Tygh\Http::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::get方法的具体用法?PHP Http::get怎么用?PHP Http::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tygh\Http
的用法示例。
在下文中一共展示了Http::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'];
}
示例2: 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;
}
示例3: 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));
}
}
示例4: 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'));
}
}
}
示例5: 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);
}
示例6: 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);
}
}
}
示例7: 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;
}
示例8: 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'));
}
}
}
}
示例9: 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;
}
}
示例10: fn_send_sms_notification
function fn_send_sms_notification($body)
{
$access_data = fn_get_sms_auth_data();
$to = Registry::get('addons.sms_notifications.phone_number');
if (fn_is_empty($access_data) || empty($to)) {
return false;
}
$concat = Registry::get('addons.sms_notifications.clickatel_concat');
//get the last symbol
if (!empty($concat)) {
$concat = intval($concat[strlen($concat) - 1]);
}
if (!in_array($concat, array('1', '2', '3'))) {
$concat = 1;
}
$data = array('user' => $access_data['login'], 'password' => $access_data['password'], 'api_id' => $access_data['api_id'], 'to' => $to, 'concat' => $concat);
$unicode = Registry::get('addons.sms_notifications.clickatel_unicode') == 'Y' ? 1 : 0;
$sms_length = $unicode ? SMS_NOTIFICATIONS_SMS_LENGTH_UNICODE : SMS_NOTIFICATIONS_SMS_LENGTH;
if ($concat > 1) {
$sms_length *= $concat;
$sms_length -= $concat * SMS_NOTIFICATIONS_SMS_LENGTH_CONCAT;
// If a message is concatenated, it reduces the number of characters contained in each message by 7
}
$body = html_entity_decode($body, ENT_QUOTES, 'UTF-8');
$body = fn_substr($body, 0, $sms_length);
if ($unicode) {
$data['unicode'] = '1';
$body = fn_convert_encoding('UTF-8', 'UCS-2', $body);
$body = bin2hex($body);
}
$data['text'] = $body;
Http::get('http://api.clickatell.com/http/sendmsg', $data);
}
示例11: fn_anti_fraud_place_order
function fn_anti_fraud_place_order(&$order_id, &$action, &$order_status)
{
$checked = db_get_field('SELECT COUNT(*) FROM ?:order_data WHERE order_id = ?i AND type = ?s', $order_id, 'F');
if ($action == 'save' || defined('ORDER_MANAGEMENT') || $checked) {
return true;
}
$return = array();
$af_settings = Registry::get('addons.anti_fraud');
if (empty($af_settings['anti_fraud_key'])) {
return false;
}
$order_info = fn_get_order_info($order_id);
if (empty($order_info['ip_address'])) {
$return['B'][] = 'af_ip_not_found';
}
$risk_factor = 1;
$request = array('license_key' => $af_settings['anti_fraud_key'], 'i' => $order_info['ip_address'], 'city' => $order_info['b_city'], 'region' => $order_info['b_state'], 'postal' => $order_info['b_zipcode'], 'country' => $order_info['b_country'], 'domain' => substr($order_info['email'], strpos($order_info['email'], '@') + 1), 'emailMD5' => $order_info['email']);
$_result = Http::get('http://www.maxmind.com/app/ccv2r', $request);
$result = array();
$_result = explode(';', $_result);
if (is_array($_result)) {
foreach ($_result as $v) {
$tmp = explode('=', $v);
$result[$tmp[0]] = $tmp[1];
}
}
unset($_result);
if (!empty($result['err'])) {
$return['B'][] = 'af_' . fn_strtolower($result['err']);
$risk_factor *= AF_ERROR_FACTOR;
} else {
// Check if order total greater than defined
if (!empty($af_settings['anti_fraud_max_order_total']) && floatval($order_info['total']) > floatval($af_settings['anti_fraud_max_order_total'])) {
$risk_factor *= AF_ORDER_TOTAL_FACTOR;
$return['B'][] = 'af_big_order_total';
}
if (!empty($order_info['user_id'])) {
// Check if this customer has processed orders
$amount = db_get_field("SELECT COUNT(*) FROM ?:orders WHERE status IN ('P','C') AND user_id = ?i", $order_info['user_id']);
if (!empty($amount)) {
$risk_factor /= AF_COMPLETED_ORDERS_FACTOR;
$return['G'][] = 'af_has_successfull_orders';
}
// Check if this customer has failed orders
$amount = db_get_field("SELECT COUNT(*) FROM ?:orders WHERE status IN ('D','F') AND user_id = ?i", $order_info['user_id']);
if (!empty($amount)) {
$risk_factor *= AF_FAILED_ORDERS_FACTOR;
$return['B'][] = 'af_has_failed_orders';
}
}
if ($result['countryMatch'] == 'No') {
$return['B'][] = 'af_country_doesnt_match';
}
if ($result['highRiskCountry'] == 'Yes') {
$return['B'][] = 'af_high_risk_country';
}
if (!empty($af_settings['anti_fraud_safe_distance']) && intval($result['distance']) > intval($af_settings['anti_fraud_safe_distance'])) {
$return['B'][] = 'af_long_distance';
}
if ($result['carderEmail'] == 'Yes') {
$return['B'][] = 'af_carder_email';
}
$risk_factor += floatval($result['riskScore']);
if ($risk_factor > 100) {
$risk_factor = 100;
}
}
$return['risk_factor'] = $risk_factor;
if (floatval($risk_factor) >= floatval($af_settings['anti_fraud_risk_factor'])) {
$action = 'save';
$order_status = Registry::get('addons.anti_fraud.antifraud_order_status');
$return['B'][] = 'af_high_risk_factor';
$return['I'] = true;
fn_set_notification('W', __('warning'), __('antifraud_failed_order'));
} else {
$return['G'][] = 'af_low_risk_factor';
}
$return = serialize($return);
$data = array('order_id' => $order_id, 'type' => 'F', 'data' => $return);
db_query("REPLACE INTO ?:order_data ?e", $data);
return true;
}
示例12: prepareRestore
/**
* Prepares restore.php file.
*
* @return bool if all necessary information was added to restore.php
*/
protected function prepareRestore($backup_filename)
{
$restore_path = $this->config['dir']['root'] . '/var/upgrade/restore.php';
$content = fn_get_contents($restore_path);
$uc_settings = Settings::instance()->getValues('Upgrade_center');
$data = "\$uc_settings = " . var_export($uc_settings, true) . ";\n\n";
$data .= "\$config = " . var_export(Registry::get('config'), true) . ";\n\n";
$data .= "\$backup_filename = '" . $backup_filename . "';\n\n";
$restore_key = md5(uniqid()) . md5(uniqid('', true));
$data .= "\$uak = '" . $restore_key . "';";
$replaced = 0;
$content = preg_replace('#\\/\\/\\[params\\].*?\\/\\/\\[\\/params\\]#ims', "//[params]\n" . $data . "\n\n//[/params]", $content, -1, $replaced);
if (!$replaced || !fn_put_contents($restore_path, $content)) {
return false;
}
// Check if restore is available through the HTTP
$result = Http::get(Registry::get('config.http_location') . '/var/upgrade/restore.php');
if ($result != 'Access denied') {
return false;
}
return $restore_key;
}
示例13: fn_get_contents
/**
* Get file contents from local or remote filesystem
*
* @param string $location file location
* @param string $base_dir
* @return string $result
*/
function fn_get_contents($location, $base_dir = '')
{
$result = '';
$path = $base_dir . $location;
if (!empty($base_dir) && !fn_check_path($path)) {
return $result;
}
// Location is regular file
if (is_file($path)) {
$result = @file_get_contents($path);
// Location is url
} elseif (strpos($path, '://') !== false) {
// Prepare url
$path = str_replace(' ', '%20', $path);
if (Bootstrap::getIniParam('allow_url_fopen') == true) {
$result = @file_get_contents($path);
} else {
$result = Http::get($path);
}
}
return $result;
}
示例14: getSimpleRates
/**
* Process simple request to shipping service server
*
* @return string Server response
*/
public function getSimpleRates()
{
$data = $this->getRequestData();
// Russian post server works very unstably, that is why we cannot use multithreading.
$key = md5(serialize($data['data']));
$response = fn_get_session_data($key);
if (empty($response)) {
$response = Http::get($data['url'], $data['data']);
fn_set_session_data($key, $response);
}
return $response;
}
示例15: array
if ($mode == 'activate') {
if (!empty($_REQUEST['payment_id']) && !empty($_REQUEST['email']) && !empty($_REQUEST['cust_id']) && !empty($_REQUEST['platform']) && !empty($_REQUEST['merchant_firstname']) && !empty($_REQUEST['merchant_lastname'])) {
Mailer::sendMail(array('to' => 'ecommerce@skrill.com', 'from' => $_REQUEST['email'], 'data' => array('mb_firstname' => $_REQUEST['merchant_firstname'], 'mb_lastname' => $_REQUEST['merchant_lastname'], 'platform' => $_REQUEST['platform'], 'email' => $_REQUEST['email'], 'cust_id' => $_REQUEST['cust_id']), 'tpl' => 'payments/cc_processors/activate_skrill.tpl'), 'A', Registry::get('settings.Appearance.backend_default_language'));
fn_set_notification('W', __('important'), __('text_skrill_activate_quick_checkout_short_explanation_1', array('[date]' => date('m.d.Y'))));
} else {
fn_set_notification('E', __('error'), __('text_skrill_empty_input_data'));
}
}
if ($mode == 'validate_secret_word') {
if (!empty($_REQUEST['email']) && !empty($_REQUEST['payment_id']) && !empty($_REQUEST['cust_id']) && !empty($_REQUEST['secret'])) {
$processor_params['pay_to_email'] = $_REQUEST['email'];
$get_data = array();
$get_data['email'] = $_REQUEST['email'];
$get_data['cust_id'] = $master_account_cust_id;
$get_data['secret'] = md5(md5($_REQUEST['secret']) . md5($master_account_secret_word));
$result = Http::get("https://www.skrill.com/app/secret_word_check.pl", $get_data);
$result_array = explode(',', $result);
if ($result_array[0] == 'OK') {
fn_set_notification('N', __('notice'), __('text_skrill_secret_word_is_correct'));
} else {
fn_set_notification('E', __('error'), __('text_skrill_secret_word_is_incorrect', array('[date]' => date('m.d.Y'))));
}
$processor_params['secret_word'] = $_REQUEST['secret'];
$old_processor_data = fn_get_processor_data($_REQUEST['payment_id']);
$old_processor_param = empty($old_processor_data['processor_params']) ? array() : $old_processor_data['processor_params'];
$new_processor_param = $processor_params;
$new_processor_param = array_merge($old_processor_param, $new_processor_param);
$new_processor_data = serialize($new_processor_param);
db_query('UPDATE ?:payments SET processor_params = ?s WHERE payment_id = ?i', $new_processor_data, $_REQUEST['payment_id']);
Tygh::$app['ajax']->assign('secret_word_' . $_REQUEST['payment_id'], $processor_params['secret_word']);
}