本文整理汇总了PHP中Tygh\Http::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::post方法的具体用法?PHP Http::post怎么用?PHP Http::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tygh\Http
的用法示例。
在下文中一共展示了Http::post方法的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: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: sendUaStat
public static function sendUaStat()
{
$access_id = TwigmoConnector::getAccessID('A');
if (!$access_id) {
return;
}
$query = db_quote('FROM ?:twigmo_ua_stat WHERE month<?s LIMIT ?i', date('Y-m-1'), 100);
$needToSend = db_get_array('SELECT *, ?s as access_id ' . $query, $access_id);
if (!count($needToSend)) {
return;
}
$responce = Http::post(TWG_UA_RULES_STAT, array('stat' => serialize($needToSend)));
if ($responce == 'ok') {
db_query('DELETE ' . $query);
}
}
示例7: zonesPickpoint
public static function zonesPickpoint($url_zone, $data_zone, $data_url)
{
$_result = array();
$response = Http::post($url_zone, json_encode($data_zone), $data_url);
$result = json_decode($response);
$data_result = json_decode(json_encode($result), true);
if (isset($data_result['Error']) && $data_result['Error'] == 1 && !empty($data_result['ErrorMessage'])) {
self::$last_error = $data_result['ErrorMessage'];
} elseif (isset($data_result['Error']) && !empty($data_result['Error'])) {
self::$last_error = $data_result['Error'];
} elseif (isset($data_result['Zones'])) {
$zone = reset($data_result['Zones']);
$_result = array('delivery_min' => $zone['DeliveryMin'], 'delivery_max' => $zone['DeliveryMax'], 'koefficient' => $zone['Koeff'], 'zone' => $zone['Zone'], 'to_pt' => $zone['ToPT']);
}
return $_result;
}
示例8: 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;
}
}
示例9: 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;
}
示例10: getSimpleRates
/**
* Process simple request to shipping service server
*
* @return string Server response
*/
public function getSimpleRates()
{
$data = $this->getRequestData();
$response = Http::post($data['url'], $data['data']);
return $response;
}
示例11: elseif
fn_set_notification('E', __('error'), $message);
}
} elseif ($pdata['processor'] == 'Avangard' && $pdata['processor_params']['returns_enabled'] == 'Y' && !empty($payment_info['avangard_ticket'])) {
$url = "https://www.avangard.ru/iacq/h2h/reverse_order";
$dom = new DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true;
$order = $dom->createElement('reverse_order');
$order->appendChild($dom->createElement('ticket', $payment_info['avangard_ticket']));
$order->appendChild($dom->createElement('shop_id', $pdata['processor_params']['shop_id']));
$order->appendChild($dom->createElement('shop_passwd', $pdata['processor_params']['password']));
if ($refund_data['amount'] != $order_info['total']) {
$order->appendChild($dom->createElement('amount', $refund_data['amount'] * 100));
}
$dom->appendChild($order);
$extra = array('headers' => array('Content-type: application/x-www-form-urlencoded;charset=utf-8', 'Expect:'));
$result_xml = Http::post($url, array('xml' => $dom->saveXML()), $extra);
$xml_data = @simplexml_load_string($result_xml);
if (!empty($xml_data->response_message)) {
if ($xml_data->response_code == 0) {
fn_set_notification('N', __('notify'), $xml_data->response_message);
$payment_info['avangard_refunded_transaction_id'] = strval($xml_data->id);
$payment_info['avangard_refunded_time'] = date('c');
$payment_info['avangard_refund_amount'] = $refund_data['amount'];
if (!empty($refund_data['cause'])) {
$payment_info['avangard_refund_cause'] = $refund_data['cause'];
}
fn_update_order_payment_info($order_info['order_id'], $payment_info);
fn_change_order_status($order_info['order_id'], $pdata['processor_params']['returned_order_status']);
} else {
fn_set_notification('E', __('error'), $xml_data->response_message);
}
示例12: fn_sdek_calculate_cost_by_shipment
function fn_sdek_calculate_cost_by_shipment($order_info, $shipping_info, $shipment_info, $rec_city_code)
{
$total = $weight = 0;
$goods = array();
$length = $width = $height = 20;
$sum_rate = 0;
$packages = array();
$shipping_info['module'] = $shipment_info['carrier'];
foreach ($shipment_info['products'] as $item_id => $amount) {
$product = $order_info['products'][$item_id];
$total += $product['subtotal'];
$product_extra = db_get_row("SELECT shipping_params, weight FROM ?:products WHERE product_id = ?i", $product['product_id']);
if (!empty($product_extra['weight']) && $product_extra['weight'] != 0) {
$product_weight = $product_extra['weight'];
} else {
$product_weight = 0.01;
}
$p_ship_params = unserialize($product_extra['shipping_params']);
$package_length = empty($p_ship_params['box_length']) ? $length : $p_ship_params['box_length'];
$package_width = empty($p_ship_params['box_width']) ? $width : $p_ship_params['box_width'];
$package_height = empty($p_ship_params['box_height']) ? $height : $p_ship_params['box_height'];
$weight_ar = fn_expand_weight($product_weight);
$weight = round($weight_ar['plain'] * Registry::get('settings.General.weight_symbol_grams') / 1000, 3);
$good['weight'] = $weight;
$good['length'] = $package_length;
$good['width'] = $package_width;
$good['height'] = $package_height;
for ($x = 1; $x <= $amount; $x++) {
$goods[] = $good;
}
foreach ($order_info['product_groups'] as $product_groups) {
if (!empty($product_groups['products'][$item_id])) {
$products[$item_id] = $product_groups['products'][$item_id];
$products[$item_id] = array_merge($products[$item_id], $good);
$products[$item_id]['amount'] = $amount;
}
$shipping_info['package_info'] = $product_groups['package_info'];
}
}
$data_package = Shippings::groupProductsList($products, $shipping_info['package_info']['location']);
$data_package = reset($data_package);
$shipping_info['package_info_full'] = $data_package['package_info_full'];
$shipping_info['package_info'] = $data_package['package_info_full'];
$url = 'http://api.edostavka.ru/calculator/calculate_price_by_json.php';
$r_url = 'http://lk.cdek.ru:8080/calculator/calculate_price_by_json.php';
$post['version'] = '1.0';
$post['dateExecute'] = date('Y-m-d');
if (!empty($shipping_info['service_params']['dateexecute'])) {
$timestamp = TIME + $shipping_info['service_params']['dateexecute'] * SECONDS_IN_DAY;
$dateexecute = date('Y-m-d', $timestamp);
} else {
$dateexecute = date('Y-m-d');
}
$post['dateExecute'] = $dateexecute;
if (!empty($shipping_settings['authlogin'])) {
$post['authLogin'] = $shipping_info['service_params']['authlogin'];
$post['secure'] = !empty($shipping_info['service_params']['authpassword']) ? md5($post['dateExecute'] . "&" . $shipping_info['service_params']['authpassword']) : '';
}
$post['authLogin'] = $shipping_info['service_params']['authlogin'];
$post['secure'] = md5($post['dateExecute'] . "&" . $shipping_info['service_params']['authpassword']);
$post['senderCityId'] = $shipping_info['service_params']['from_city_id'];
$post['receiverCityId'] = $rec_city_code;
$post['tariffId'] = $shipping_info['service_params']['tariffid'];
$post['goods'] = $goods;
$post = json_encode($post);
$key = md5($post);
$sdek_data = fn_get_session_data($key);
$content = json_encode($post);
if (empty($sdek_data)) {
$response = Http::post($url, $post, array('Content-Type: application/json', 'Content-Length: ' . strlen($content)), array('timeout' => SDEK_TIMEOUT));
if (empty($response)) {
$response = Http::post($r_url, $post, array('Content-Type: application/json', 'Content-Length: ' . strlen($content)), array('timeout' => SDEK_TIMEOUT));
}
fn_set_session_data($key, $response);
} else {
$response = $sdek_data;
}
$result = json_decode($response, true);
$sum_rate = Shippings::calculateRates(array($shipping_info));
$sum_rate = reset($sum_rate);
$result = $sum_rate['price'];
return $result;
}
示例13: fn_cmpi_authenticate
/**
* Make cmpi_authenticate request to 3-D Secure service provider.
*
* @return boolean true
*/
function fn_cmpi_authenticate()
{
$session = Tygh::$app['session'];
$cardinal_request = <<<EOT
<CardinalMPI>
<Version>1.7</Version>
<MsgType>cmpi_authenticate</MsgType>
<ProcessorId>{$session['cmpi']['processor_id']}</ProcessorId>
<MerchantId>{$session['cmpi']['merchant_id']}</MerchantId>
<TransactionPwd>{$session['cmpi']['transaction_password']}</TransactionPwd>
<TransactionType>C</TransactionType>
<TransactionId>{$session['cmpi']['transaction_id']}</TransactionId>
<PAResPayload>{$session['cmpi']['pares']}</PAResPayload>
</CardinalMPI>
EOT;
$response_data = Http::post(Tygh::$app['session']['cmpi']['transaction_url'], array('cmpi_msg' => $cardinal_request));
$cmpi = @simplexml_load_string($response_data);
if (empty($response_data) || $cmpi === false) {
Tygh::$app['session']['cmpi']['err_no'][1] = 0;
Tygh::$app['session']['cmpi']['err_desc'][1] = 'Connection problem';
Tygh::$app['session']['cmpi']['signature'] = 'N';
Tygh::$app['session']['cmpi']['pares'] = 'N';
} else {
Tygh::$app['session']['cmpi']['signature'] = (string) $cmpi->SignatureVerification;
Tygh::$app['session']['cmpi']['pares'] = (string) $cmpi->PAResStatus;
Tygh::$app['session']['cmpi']['eci_flag'] = (string) $cmpi->EciFlag;
Tygh::$app['session']['cmpi']['xid'] = (string) $cmpi->Xid;
Tygh::$app['session']['cmpi']['cavv'] = (string) $cmpi->Cavv;
Tygh::$app['session']['cmpi']['err_no'][1] = (string) $cmpi->ErrorNo;
Tygh::$app['session']['cmpi']['err_desc'][1] = (string) $cmpi->ErrDesc;
}
return true;
}
示例14: array
</PayData>
</Sale>
</Transaction>
</Transactions>
</RequestData>
<RequestAuth>
<UserPass>
<User>{$payflow_username}</User>
<Password>{$payflow_password}</Password>
</UserPass>
</RequestAuth>
</XMLPayRequest>
XML;
$post_url = "https://" . $payflow_url . ":443/transaction";
Registry::set('log_cut_data', array('CardNum', 'ExpDate', 'NameOnCard', 'CVNum'));
$response_data = Http::post($post_url, $post, array('headers' => array('Content-type: text/xml', 'X-VPS-REQUEST-ID: ' . $payflow_order_id, 'X-VPS-VIT-CLIENT-CERTIFICATION-ID: 5b329b34269933161c60aeda0f14d0d8', 'X-VPS-CLIENT-TIMEOUT: 45', 'Connection: close')));
$pp_response = array();
$pp_response['reason_text'] = '';
preg_match("/<Result>(.*)<\\/Result>/", $response_data, $_result);
if (!empty($_result[1])) {
$pp_response['reason_text'] = "Result: " . $_result[1];
}
preg_match_all("/<Message>(.*?)<\\/Message>/", $response_data, $_message);
if (!empty($_message[1])) {
$pp_response['reason_text'] .= "; " . end($_message[1]) . "; ";
}
preg_match("/<AuthCode>(.*)<\\/AuthCode>/", $response_data, $_auth);
if (!empty($_auth[1])) {
$pp_response['reason_text'] .= "Auth Code: " . $_auth[1] . "; ";
}
preg_match('/<TransactionResult (?:.*) Duplicate="(.*)"/i', $response_data, $_duplicate);
示例15: _addDellinCities
public function _addDellinCities($url_cities, $post)
{
$file_dir = fn_get_files_dir_path() . "dellin/";
fn_mkdir($file_dir);
@chmod($file_dir, 0777);
$file_path = $file_dir . date("Y-m-d", TIME) . '_cities.csv';
if (!file_exists($file_path)) {
$response = Http::post($url_cities, json_encode($post), $this->url_params);
$result = (array) json_decode($response);
file_put_contents($file_path, file_get_contents($result['url']));
if (!empty($result['url'])) {
$max_line_size = 65536;
// 64 Кб
$data_city = array();
$delimiter = ',';
$encoding = fn_detect_encoding($result['url'], 'F', CART_LANGUAGE);
if (!empty($encoding)) {
$result['url'] = fn_convert_encoding($encoding, 'UTF-8', $result['url'], 'F');
} else {
fn_set_notification('W', __('warning'), __('text_exim_utf8_file_format'));
}
$f = false;
if ($result['url'] !== false) {
$f = fopen($result['url'], 'rb');
}
if ($f) {
$import_schema = fgetcsv($f, $max_line_size, $delimiter);
$schema_size = sizeof($import_schema);
$skipped_lines = array();
$line_it = 1;
while (($data = fn_fgetcsv($f, $max_line_size, $delimiter)) !== false) {
$line_it++;
if (fn_is_empty($data)) {
continue;
}
if (sizeof($data) != $schema_size) {
$skipped_lines[] = $line_it;
continue;
}
$data = str_replace(array('\\r', '\\n', '\\t', '"'), '', $data);
$data_city = array_combine($import_schema, Bootstrap::stripSlashes($data));
if (!empty($data_city)) {
$dellin_city = array('number_city' => $data_city['id'], 'code_kladr' => str_replace(' ', '', $data_city['codeKLADR']), 'is_terminal' => $data_city['isTerminal']);
$first_pos = strpos($data_city['name'], '(');
$end_pos = strpos($data_city['name'], ')') - $first_pos;
if (!empty($first_pos)) {
$dellin_city['state'] = str_replace(array("(", ")"), "", substr($data_city['name'], $first_pos, $end_pos));
$dellin_city['city'] = str_replace(array('(' . $dellin_city['state'] . ')', '"'), "", $data_city['name']);
} else {
$dellin_city['state'] = str_replace(array('г.', 'г', 'г. ', 'г '), '', $data_city['name']);
$dellin_city['city'] = $data_city['name'];
}
$dellin_city['city_id'] = db_get_field("SELECT city_id FROM ?:rus_dellin_cities WHERE code_kladr = ?s", $dellin_city['code_kladr']);
db_query("REPLACE INTO ?:rus_dellin_cities ?e", $dellin_city);
}
}
}
}
}
}