1、核心代码:

<?php
require("helper.php");
header('content-type:text/html;charset=utf-8');

$key = 'C43D436036E643F5AFA654FED758BCF7';

//参数数组
$post_data = array (
    "parter" => '2308',
    "orderid" => '201711021121',
);

//签名
ksort($post_data);//键按ASCII码升序排序
$preSignString=getPreSignString($post_data);
$sign = md5($preSignString.'&key='.$key);
$sign=strtoupper($sign);//大写

//签名参数添加到参数数组
$post_data['sign']=$sign;

//参数转成json
$parameters =json_encode($post_data);

//发送请求
$url='http://localhost:64781/api/Query/QueryStatus';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

//处理返回数据
$responseData=json_decode($response,true);//发序列化为数组

print_r($responseData);
post.php

相关文章:

  • 2022-12-23
  • 2021-11-11
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2021-12-18
  • 2021-07-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-10-20
相关资源
相似解决方案