本文整理汇总了PHP中sendHttpRequest函数的典型用法代码示例。如果您正苦于以下问题:PHP sendHttpRequest函数的具体用法?PHP sendHttpRequest怎么用?PHP sendHttpRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendHttpRequest函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cx
public function cx($conf)
{
$params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'signMethod' => '01', 'txnType' => '00', 'txnSubType' => '00', 'bizType' => '000000', 'accessType' => '0', 'channelType' => '07', 'orderId' => $conf['ordernumber'], 'merId' => '898110248160161', 'txnTime' => date("YmdHis", strtotime($conf['addtime'])));
// 签名
sign($params);
// 发送信息到后台
$result = sendHttpRequest($params, SDK_SINGLE_QUERY_URL);
//返回结果展示
$result_arr = coverStringToArray($result);
$insert = array();
$insert['ordernumber'] = $conf['ordernumber'];
$insert['fqtime'] = $conf['addtime'];
$insert['ylnumber'] = isset($result_arr['queryId']) ? $result_arr['queryId'] : 0;
$insert['yltime'] = isset($result_arr['traceTime']) ? $result_arr['traceTime'] : 0;
$insert['ylstatus'] = $conf['cztype'];
$insert['cxtime'] = date("Y-m-d H:i:s");
$insert['cxstatus'] = $result_arr['respCode'];
$insert['cxmiaosu'] = $result_arr['respMsg'];
$insert['userId'] = $conf['userId'];
$insert['origRespCode'] = isset($result_arr['origRespCode']) ? $result_arr['origRespCode'] : 0;
$insert['origRespMsg'] = isset($result_arr['origRespMsg']) ? $result_arr['origRespMsg'] : 0;
$this->db->insert("yinlian", $insert);
if ($this->db->insert_id() > 0) {
$this->db->query("update `cz` set `cl`=1 where logId=" . $conf['logId']);
}
}
示例2: getTN
function getTN($order)
{
$this->params['orderId'] = $order['OrderID'];
$this->params['txnTime'] = date('YmdHis');
$this->params['txnAmt'] = $order['OrderPrice'] * 100;
$this->params['reqReserved'] = base64_encode(json_encode(array('pay_type' => 3)));
$params = $this->params;
sign($params);
$result = sendHttpRequest($params, SDK_App_Request_Url);
$result_arr = coverStringToArray($result);
// echo '<pre>';
// print_r($params);
// print_r($result_arr);
if (verify($result_arr)) {
return $result_arr["tn"];
} else {
return false;
}
}
示例3: header
<?php
header('Content-type:text/html;charset=utf-8');
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/common.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/SDKConfig.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/secureUtil.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/httpClient.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/log.class.php';
/**
* 预授权完成
*/
/**
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己需要,按照技术文档编写。该代码仅供参考
*/
// 初始化日志
$log = new PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
$log->LogInfo("===========处理后台请求开始============");
$params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'signMethod' => '01', 'txnType' => '03', 'txnSubType' => '00', 'bizType' => '000201', 'accessType' => '0', 'channelType' => '07', 'orderId' => date('YmdHis'), 'merId' => '888888888888888', 'origQryId' => '201502281110005523968', 'txnTime' => date('YmdHis'), 'txnAmt' => '100', 'backUrl' => SDK_BACK_NOTIFY_URL, 'reqReserved' => ' 透传信息');
// 签名
sign($params);
echo "请求:" . getRequestParamString($params);
$log->LogInfo("后台请求地址为>" . SDK_BACK_TRANS_URL);
// 发送信息到后台
$result = sendHttpRequest($params, SDK_BACK_TRANS_URL);
$log->LogInfo("后台返回结果为>" . $result);
echo "应答:" . $result;
//返回结果展示
$result_arr = coverStringToArray($result);
echo verify($result_arr) ? '验签成功' : '验签失败';
?>
示例4: header
<?php
header('Content-type:text/html;charset=GBK');
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/gbk/func/common.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/gbk/func/SDKConfig.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/gbk/func/secureUtil.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/gbk/func/httpClient.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/gbk/func/log.class.php';
/**
* 文件传输类交易
*/
/**
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己需要,按照技术文档编写。该代码仅供参考
*/
// 初始化日志
$log = new PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
$log->LogInfo("===========处理后台请求开始============");
$params = array('version' => '5.0.0', 'encoding' => 'GBK', 'certId' => getSignCertId(), 'txnType' => '76', 'signMethod' => '01', 'txnSubType' => '01', 'bizType' => '000000', 'accessType' => '0', 'merId' => '700000000000001', 'settleDate' => '0119', 'txnTime' => date('YmdHis'), 'fileType' => '00');
// 签名
sign($params);
echo "请求:" . getRequestParamString($params);
$log->LogInfo("后台请求地址为>" . SDK_FILE_QUERY_URL);
// 发送信息到后台
$result = sendHttpRequest($params, SDK_FILE_QUERY_URL);
$log->LogInfo("后台返回结果为>" . $result);
echo "应答:" . $result;
//返回结果展示
$result_arr = coverStringToArray($result);
echo verify($result_arr) ? '验签成功' : '验签失败';
// 处理文件,保存路径在配置文件中修改,注意预先建立文件夹并授读写权限
deal_file($result_arr);
示例5: header
header('Content-type:text/html;charset=utf-8');
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/common.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/SDKConfig.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/secureUtil.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/httpClient.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/upacp_sdk_php/utf8/func/log.class.php';
/**
* 预授权-控件
*/
/**
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己需要,按照技术文档编写。该代码仅供参考
*/
// 初始化日志
$log = new PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
$log->LogInfo("============处理前台请求开始===============");
// 初始化日志
$params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'txnType' => '02', 'txnSubType' => '01', 'bizType' => '000201', 'frontUrl' => SDK_FRONT_NOTIFY_URL, 'backUrl' => SDK_BACK_NOTIFY_URL, 'signMethod' => '01', 'channelType' => '08', 'accessType' => '0', 'merId' => '888888888888888', 'orderId' => date('YmdHis'), 'txnTime' => date('YmdHis'), 'txnAmt' => '100', 'currencyCode' => '156', 'orderDesc' => '订单描述', 'reqReserved' => ' 透传信息');
// 签名
sign($params);
echo "请求:" . getRequestParamString($params);
$log->LogInfo("后台请求地址为>" . SDK_App_Request_Url);
// 发送信息到后台
$result = sendHttpRequest($params, SDK_App_Request_Url);
$log->LogInfo("后台返回结果为>" . $result);
echo "应答:" . $result;
//返回结果展示
$result_arr = coverStringToArray($result);
echo verify($result_arr) ? '验签成功' : '验签失败';
?>
示例6: file_put_contents
//echo("StartBtn: " . $kart_drv_name['DEV1'] . "<br/>\n\n");
// store the config
file_put_contents('config.php', '<?php return ' . var_export($kart_drv_name, true) . ';');
// Send Start command
if (FALSE == sendHttpRequest("START:ALL:")) {
echo "Failed to send START request <br>";
return FALSE;
}
$Started = True;
$kart_drv_name['STARTED'] = true;
file_put_contents('config.php', '<?php return ' . var_export($kart_drv_name, true) . ';');
} else {
if (isset($_POST["stopBtn"])) {
//echo ("StopBtn: " . $kart_drv_name['DEV1'] . "<br/>\n\n");
// Send Start command
if (FALSE == sendHttpRequest("STOP:ALL:")) {
echo "Failed to send STOP request <br>";
return FALSE;
}
$Started = False;
$kart_drv_name['STARTED'] = false;
file_put_contents('config.php', '<?php return ' . var_export($kart_drv_name, true) . ';');
} else {
if (isset($_POST["newBtn"]) && $Started == False) {
//echo ("new session: <br/>\n\n");
// cleanup the session data
cleanupSession();
// Clear the driver names
foreach ($kart_drv_name as $key => $val) {
if ($key == 'SRV_NAME' || $key == 'SRV_IP' || $key == 'SRV_PORT' || $key == 'STARTED') {
continue;
示例7: while
return TRUE;
}
//$status = explode(" ", $line);
$line = "";
while (!feof($fp)) {
$line .= fgets($fp, 2048);
}
echo "command failed! Recvd:" . $line . "<br>";
return FALSE;
}
function sendHttpRequest($cmd)
{
return sendHttprequest_internal($cmd);
//return True;
}
if (FALSE == sendHttpRequest("STATUS:")) {
echo "Failed to send STATUS request <br>";
}
echo "<html>";
echo "<div>";
for ($i = 1; $i <= MAX_KART_NUM; $i++) {
echo "<div id=\"lap_count" . $i . "\">";
if ((int) $kart_session_data[$i]->currLapCount == 0) {
echo "-";
} else {
echo $kart_session_data[$i]->currLapCount;
}
echo "</div>";
echo "<div id=\"battery_level" . $i . "\">";
if ((int) $kart_session_data[$i]->batLevel == 0) {
echo "-";
示例8: handleSwitch
function handleSwitch($devId, $textBoxName)
{
global $GlobalData;
global $kart_session_data;
$ret = TRUE;
if ($kart_session_data[$devId]->isStarted() == True) {
// Send stop command
if (FALSE == sendHttpRequest("STOP:KART" . $devId . ":")) {
echo "Failed to send STOP request for " . $devName . "<br>" . "<br> Please check the connection with Server <br>";
$ret = FALSE;
}
$kart_session_data[$devId]->start(False);
} else {
$kart_session_data[$devId] = new sessionData($devId, $_POST[$textBoxName]);
//cleanup the previous session for the device
//cleanupSession ($devId);
// Send Start command
if (FALSE == sendHttpRequest("START:KART" . $devId . ":")) {
echo "Failed to send START request for kart" . $devId . "<br> Please check the connection with Server <br>";
$ret = FALSE;
//return FALSE;
} else {
$kart_session_data[$devId]->start(True);
}
}
//var_dump($GlobalData);
// store the config
file_put_contents('data_config.php', '<?php return ' . var_export(serialize($GlobalData), true) . '; ?>', LOCK_EX);
file_put_contents('data_session.php', '<?php return ' . var_export(serialize($kart_session_data), true) . '; ?>', LOCK_EX);
return $ret;
}
示例9: cancelpay
public function cancelpay($oid)
{
$order = M('Order');
$map['oid'] = $oid;
$oinfo = $order->where($map)->find();
if ($oinfo['paytype'] == '0') {
$log = new \PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
$log->LogInfo("============处理前台请求开始===============");
// 初始化日志
$params = array('version' => '5.0.0', 'encoding' => 'utf-8', 'certId' => getSignCertId(), 'signMethod' => '01', 'txnType' => '32', 'txnSubType' => '00', 'bizType' => '000201', 'accessType' => '0', 'channelType' => '07', 'orderId' => build_order_no(), 'merId' => '898110275120075', 'txnTime' => date('YmdHis'), 'backUrl' => SDK_CDE_BACK_NOTIFY_URL, 'reqReserved' => ' 透传信息');
$params['origQryId'] = $oinfo['trade_no'];
$cdeposit = $oinfo['deposit'] + $oinfo['c_price'];
$params['txnAmt'] = 10;
//floatval($cdeposit) * 100;
sign($params);
//echo "请求:" . getRequestParamString ( $params );
$log->LogInfo("后台请求地址为>" . SDK_BACK_TRANS_URL);
// 发送信息到后台
$result = sendHttpRequest($params, SDK_BACK_TRANS_URL);
$log->LogInfo("后台返回结果为>" . $result);
//echo "应答:" . $result;
//返回结果展示
$result_arr = coverStringToArray($result);
if (verify($result_arr)) {
if ($result_arr['respCode'] == '00') {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
示例10: die
if (!isset($_GET['card_info']) || !isset($_GET['redirect_url'])) {
die(json_encode(array('status' => 400, 'message' => 'Invalid input: card_info, redirect_url are required.')));
}
$decrypted_post_data = decrypt_post_data($_GET['card_info']);
try {
$card_info = json_decode($decrypted_post_data, True);
} catch (Exception $e) {
die(json_encode(array('status' => 400, 'message' => 'Error parsing post data.')));
}
$params = array('version' => '5.0.0', 'encoding' => 'UTF-8', 'certId' => getSignCertId(), 'signMethod' => '01', 'txnType' => '79', 'txnSubType' => '00', 'bizType' => '000301', 'accessType' => '0', 'merId' => $SDK_MER_ID, 'txnTime' => date('YmdHis'), 'orderId' => date('YmdHis'), 'accType' => $card_info['acc_type'], 'accNo' => $card_info['acc_no'], 'customerInfo' => customerInfo_sms($card_info['acc_no'], $card_info['certif_tp'], $card_info['certif_id'], $card_info['customer_name'], $card_info['phone_no'], $card_info['pin'], $card_info['cvn2'], $card_info['expired']), 'encryptCertId' => getEncryptCertId(), 'channelType' => '07', 'backUrl' => $SDK_BACK_NOTIFY_URL, 'frontUrl' => $_GET['redirect_url']);
// 检查字段是否需要加密
encrypt_params($params);
// 签名
sign($params);
// 发送信息到后台
$result = sendHttpRequest($params, $SDK_FRONT_TRANS_URL);
/*$result_array = coverStringToArray($result);
if ($result_array['respCode'] != '00') {
die(json_encode(array(
'status'=>'-1',
'message'=>'Error querying Unionpay API.',
'error_resp_code'=>$result_array['respCode']
)));
}
echo json_encode(array(
'status'=>200,
'message'=>'Success',
'activate_status'=>$result_array['activateStatus']
));*/