api-with-body-string.php 819 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * 通用接口调用 -> 查询交易
  4. */
  5. require_once '../../vendor/autoload.php';
  6. $config = new \Lakala\OpenAPISDK\V2\V2Configuration();
  7. $api = new \Lakala\OpenAPISDK\V2\Api\V2LakalaApi($config);
  8. try {
  9. // 字符串格式的body
  10. $body = '{"timestamp":"1728531818230","rnd":null,"ver":"1.0.0","reqId":null,"reqData":{"mercId":"822290070111135","termNo":"29034705","ornOrderId":"LKLB2C202206161830570630001BUF"},"locationInfo":null,"termExtInfo":null}';
  11. $response = $api->apiWithBody('/api/v2/labs/txn/query', $body);
  12. print_r($response->getRespData());
  13. echo $response->getRetCode();
  14. # 响应头信息
  15. print_r($response->getHeaders());
  16. # 响应原文
  17. echo $response->getOriginalText();
  18. } catch (\Lakala\OpenAPISDK\V3\ApiException $e) {
  19. echo $e->getMessage();
  20. }