HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /var/www/html/breadsecret.com_bak20260325/AlipayHKBackend/cc_result2.php
<?php session_start() ;?>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<?php

//error_reporting(E_ALL);
//ini_set('display_errors', 1);
ob_start();

$url = 'https://openapi-int.qfapi.com'; // for credit card
$api_type = '/trade/v1/payment_verify';

echo "Result From 3ds Challenge";
echo "<pre>";
    print_r($_POST);
echo "</pre>";
echo "<hr>";
//credit card
$app_code = 'FB39698329554171A179031DCAE6EEE7';
$app_key = 'C5856334C6624CEBB1A5C7307718E93D';

echo "App Code";
echo "<br>";
echo $app_code;
echo "<br>";
echo "<hr>";
echo "App Key";
echo "<br>";
echo $app_key;
echo "<br>";
echo "<hr>";


$fields_string = '';

$_SESSION['set_cookie'] = str_replace("Secure;","",$_SESSION['set_cookie']);
$chnl_ext = ["session_id"=>$_SESSION['session_id'], "set_cookie"=>$_SESSION['set_cookie']];

$fields = array(  
  'syssn' => urlencode($_SESSION['syssn']),
  'txdtm' => date("Y-m-d H:i:s"),
  'chnl_ext' => str_replace(":",": ",json_encode($chnl_ext, JSON_UNESCAPED_SLASHES)),
  //'chnl_ext' => "'".json_encode($chnl_ext, JSON_UNESCAPED_SLASHES)."'",
  'out_trade_no' => urlencode($_SESSION['out_trade_no'])
);
ksort($fields); //字典排序A-Z升序方式

echo "End Point";
echo "<br>";
echo $url.$api_type;
echo "<hr>";

echo "Input Field";
    echo "<pre>";
        print_r($fields);
    echo "</pre>";
echo "<hr>";

foreach ($fields as $key => $value) {
    $fields_string .= $key . '=' . $value . '&';
  }
  
  $fields_string = substr($fields_string, 0, strlen($fields_string) - 1);
  
  echo "Input Field String";
  echo "<br>";
  echo $fields_string;
  echo "<hr>";  


  $sign = strtoupper(md5($fields_string . $app_key));
  
  //// Header ////
  $header = array();
  $header[] = 'X-QF-APPCODE: ' . $app_code;
  $header[] = 'X-QF-SIGN: ' . $sign;
  
  echo "Input Header";
    echo "<pre>";
        print_r($header);
    echo "</pre>";
    echo "<hr>";

  //Post Data

  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url . $api_type);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
  $output = curl_exec($ch);
  curl_close($ch);
  
  $final_data = json_decode($output, true);
  
  echo "Output";
      echo "<pre>";
          print_r($final_data); 
      echo "</pre>";
      echo "<hr>";


 // ob_end_flush();

?>