当前位置: 首页>>代码示例>>PHP>>正文


PHP HttpClient::buildQueryString方法代码示例

本文整理汇总了PHP中HttpClient::buildQueryString方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpClient::buildQueryString方法的具体用法?PHP HttpClient::buildQueryString怎么用?PHP HttpClient::buildQueryString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpClient的用法示例。


在下文中一共展示了HttpClient::buildQueryString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: customHttpClient

function customHttpClient($SERVER, $PATH, $COOKIES, $PARAMS)
{
    //return;//return '{"resHeader":{"backUrl":"","flag":"0","msg":"访问失败"}}';
    //到远程服务器查询登录状态
    include_once dirname(__FILE__) . '/httpclient.inc.php';
    try {
        $client = new HttpClient($SERVER);
        $client->timeout = 10;
        $client->setCookies($COOKIES);
        $client->setPersistCookies(true);
        $postURL = $PATH;
        customCreateLogFile(dirname(__FILE__) . "/httpclient_log/" . date('Ymd') . ".txt", getHexDecode($client->buildQueryString($PARAMS)));
        if (!$client->post($postURL, $PARAMS)) {
            customCreateLogFile(dirname(__FILE__) . "/httpclient_log/" . date('Ymd') . ".txt", "\nPUT SERVER:" . $SERVER . "" . $PATH . "\nFAILD1");
            return '{"resHeader":{"backUrl":"","flag":"0","msg":"访问失败1"}}';
        }
    } catch (Exception $e) {
        customCreateLogFile(dirname(__FILE__) . "/httpclient_log/" . date('Ymd') . ".txt", "\nPUT SERVER:" . $SERVER . "" . $PATH . "\nFAILD2");
        return '{"resHeader":{"backUrl":"","flag":"0","msg":"访问失败2"}}';
    }
    $response = $client->getContent();
    customCreateLogFile(dirname(__FILE__) . "/httpclient_log/" . date('Ymd') . ".txt", "\nPUT SERVER:" . $SERVER . "" . $PATH . "\nPUT COOKIES:" . (is_array($COOKIES) ? var_export($COOKIES, true) : '') . "\nPUT DATA:" . (is_array($PARAMS) ? var_export($PARAMS, true) : $PARAMS) . "\nGET DATA:" . iconv('GBK', 'UTF-8', $response));
    return iconv('GBK', 'UTF-8', $response);
}
开发者ID:CalixtoXie,项目名称:tobeluludoc,代码行数:24,代码来源:func.inc.php

示例2: eposSale

function eposSale(array $bizArray, $actionURL, $merchantKey, $logName)
{
    // 调用签名函数生成签名串
    $ReqHmacString = getReqHmacString($bizArray, $logName, $merchantKey);
    // 组成请求串
    $actionHttpString = HttpClient::buildQueryString($bizArray) . "&pr_NeedResponse=1" . "&hmac=" . $ReqHmacString;
    // echo $actionURL."?".$actionHttpString;exit;
    // 记录发起支付请求的参数
    logurl("发起请求", $actionURL . "?" . $actionHttpString, $logName);
    // 发起支付请求
    $pageContents = HttpClient::quickPost($actionURL, $actionHttpString);
    if ($GLOBALS['uid'] == '20310462') {
        echo $pageContents . "<br>";
    }
    // 记录收到的提交结果
    logurl("请求回写", $pageContents, $logName);
    $result = explode("\n", $pageContents);
    for ($index = 0; $index < count($result); $index++) {
        $result[$index] = trim($result[$index]);
        if (strlen($result[$index]) == 0) {
            continue;
        }
        $aryReturn = explode("=", $result[$index]);
        $sKey = $aryReturn[0];
        $sValue = $aryReturn[1];
        if ($sKey == "r0_Cmd") {
            $r0_Cmd = $sValue;
        } elseif ($sKey == "r1_Code") {
            $r1_Code = $sValue;
        } elseif ($sKey == "r2_TrxId") {
            $r2_TrxId = $sValue;
        } elseif ($sKey == "r6_Order") {
            $r6_Order = $sValue;
        } elseif ($sKey == "errorMsg") {
            $errorMsg = $sValue;
        } elseif ($sKey == "hmac") {
            $hmac = $sValue;
        }
        /* else{
        		   return $result[$index];
        		}   */
    }
    $hmac = iconv("UTF-8", "GB2312", $hmac);
    // 进行校验码检查 取得加密前的字符串
    $sbOld = "";
    // 加入业务类型
    $sbOld = $sbOld . $r0_Cmd;
    // 加入支付结果
    $sbOld = $sbOld . $r1_Code;
    // 加入易宝支付交易流水号
    $sbOld = $sbOld . $r2_TrxId;
    // 加入商户订单号
    $sbOld = $sbOld . $r6_Order;
    $sNewString = HmacMd5($sbOld, $merchantKey, $logName);
    logurl("订单号:" . $r6_Order, "本地生成HMAC:" . $sNewString . "返回HMAC:" . $hmac, $logName);
    $uid = substruid($r6_Order, 14);
    $money = $bizArray['p3_Amt'];
    global $_MooClass, $dbTablePre;
    $sql_getpayid = "SELECT max(id) id FROM {$dbTablePre}payment_new WHERE order_id='{$r6_Order}'";
    $getpayid = $_MooClass['MooMySQL']->getOne($sql_getpayid, true);
    $id = $getpayid['id'];
    $sql_p = "SELECT pay_service FROM {$dbTablePre}payment_new WHERE id='{$id}'";
    $payservice = $_MooClass['MooMySQL']->getOne($sql_p, true);
    //	if($money=='1899'){
    //		$attach='0';
    //	}elseif($money=='1399'){
    //		$attach='1';
    //	}elseif($money=='1399.00'){
    //		$attach='2';
    //	}else{
    //		$attach='1';
    //	}
    //
    if ($payservice['pay_service'] == '0') {
        $attach = '0';
    } elseif ($payservice['pay_service'] == '1' || $payservice['pay_service'] == '3') {
        $attach = '1';
    } elseif ($payservice['pay_service'] == '2') {
        $attach = '2';
    } else {
        $attach = '1';
    }
    if ($GLOBALS['uid'] == '20310462') {
        echo $sNewString;
        exit;
    }
    // 校验码正确
    if ($sNewString == $hmac) {
        if ($r1_Code == "1") {
            logurl("请求成功", "本地生成HMAC:" . $sNewString . "返回HMAC:" . $hmac, $logName);
            //返回信息 数组表示
            $paytime = date("Y.m.d H:i:s");
            $payurl = array('pay' => '1', 'out_trade_no' => $r6_Order, 'paytime' => $paytime, 'bank_type' => '易宝支付', 'trade_state' => '0', 'get_img' => '05.gif', 'img' => $attach, 'total_fee' => $bizArray['p3_Amt'], 'uid' => $uid);
            //会员ID
            $payurl = implode(',', $payurl);
            $payurl = $payurl . ',yeepay';
            header("Location:./../../index.php?n=payment&h=payreturnurl&payurl=" . $payurl);
            return;
        } elseif ($r1_Code == "66") {
            $errorinfo = iconv("GB2312", "UTF-8", "订单金额过小!");
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:zays,代码行数:101,代码来源:yeepayeposcommon.php


注:本文中的HttpClient::buildQueryString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。